Hi,

In my application I have a number of fields that allow validation, by means
of a validation CheckBox. In order to provide some flexibility for this kind
of validation fields, I'd like to have them implemented in a Component (i.e.
ValidationTickPanel), so that they provide their own markup and other panels
using it should not know about its contents. ValidationTickPanel extends
Panel in order to be able to provide own markup.

The problem is, I'd like to have the CheckBox's wicket:id set from the
parent panel (in order to use CompoundPropertyModel). But I'm afraid that
it's impossible to have a variable wicket_id inside
ValidationTickPanel.html...

public class ValidationTick extends Panel implements RestrictedComponent {
    public ValidationTick(String componentId, String checkId, IModel
checkModel){
        super(componentId);
        CheckBox check =  new CheckBox(checkId, checkModel);
        Label label = new Label(checkId+"Label", new
StringResourceModel(""));
        add(check);
        add(label);
    }
}

<wicket:panel>
    <input type="checkbox" wicket:id="???"></input>
    <span wicket:id="???Label"></span>
</wicket:panel>

Usually, checkModel would be null as the goal would be to use
compoundPropertyModel on the checkBox..My question is, is it possible to
achieve this ? Or should I be discarding the CPM idea and passing for
instance a PropertyModel to ValidationTickPanel ?

Thanks a lot,
Xavier

Reply via email to