Try removing the id attributes from the markup. Wicket likes to generate this for itself. You'll also need to add a FormLabel (or something named like that) to the <for> element.

Regards,
    Erik.


Andy Czerwonka wrote:
I found this thread:

http://www.mail-archive.com/users@wicket.apache.org/msg04400.html

I have written similair code, but I'm getting an exception. Clearly my markup is wrong, but I can't for the life of me unnderstand why? When I inspect the code, the page contains the right things. I'm a wicket newbie to be sure, so apologies if it's a silly question.

Here's the java snippet (similair to the java on the above thread)

private void buildForm() {

    RequiredTextField nameTextField = new RequiredTextField("name");

    nameTextField.setLabel(new Model("Business Name"));

    add(nameTextField);

    addFieldLabel(this, nameTextField);

    add(new Button("saveButton"));

}


protected FormComponentLabel addFieldLabel(final MarkupContainer container, final FormComponent formComponent) {

SimpleFormComponentLabel label = new SimpleFormComponentLabel(formComponent.getId() + "Label",

formComponent);

container.add(label);

return label;

}

The markup is as follows:

<form wicket:id="newListingForm" action="save">

<fieldset>

<label for="name" wicket:id="nameLabel" id="nameLabel">[nameLabel]</label>

    <input wicket:id="name" id="name" type="text" size="50" />

    <input type="submit" wicket:id="saveButton" value="save" />

</fieldset>

</form>

The error looks like:

1. [MarkupContainer [Component id = nameLabel, page = ca.arcticpenguin.mff.NewListingPage, path = 0:newListingForm:nameLabel.SimpleFormComponentLabel, isVisible = true, isVersioned = false]]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to