Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wicket Drop down choice to set default value

Tags:

wicket

I want to replace "choose one" option in drop down choice with other String "successfully occured" and I dont want to show list item to set the default.

DropDownChoice<Person> customer = new DropDownChoice<Person>(
                        "customer", new PropertyModel<Person>(customermodel, "customer"),list, new ChoiceRenderer<Person>("name", "id"));
like image 672
Nitin4Android Avatar asked Nov 16 '11 10:11

Nitin4Android


2 Answers

The best way to do this is to put the definition

customer.null=successfully occured

in a properties file associated with the form or page containing the choice.

The properties file can also be localized so that what's shown depends on the locale.

like image 150
Don Roby Avatar answered Nov 11 '22 21:11

Don Roby


For me I had to do following to get this done.

customer.setNullValid(true);

Then created a file named "HomePage.properties" (I added the drop down to HomePage)

set the null text in the .properties file as bellow.

nullValid=Choose one..
like image 30
Janaka Priyadarshana Avatar answered Nov 11 '22 20:11

Janaka Priyadarshana