Hello,
I'm using a DropDownChoice and I have one entry which shouldn't be selected.
I implemented a validator which captures this feature. The validator does the right thing but only when the page is submitted.
The problem is that I need an info message before submitting the form!
Here some code:
The DropDownChoice initialized in the Page-Constructor:
XXXDropDownChoice dropDownChoice = new XXXDropDownChoice(
"xxx", listModel, new ChoiceRenderer("name",
"id"), false);
dropDownChoice.add(new XXXChoiceValidator());
form.add(dropDownChoice);
if (!dropDownChoice.isChoiceAvailable()){
getFeedbackMessages().info(dropDownChoice ,"An info text!");
}
The method isChoiceAvailable() in my XXXDropDownChoice is implemented using the model and the choices:
public boolean isChoiceAvailable(){
List baseChoicesList = super.getChoices();
Object choiceObject = getModelObject();
return baseChoicesList.contains(choiceObject);
}
Thanks for Help,
Daniel
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user