Nitin4Android
Nitin4Android

Reputation: 864

Wicket Drop down choice to set default value

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"));

Upvotes: 8

Views: 6519

Answers (2)

Janaka Priyadarshana
Janaka Priyadarshana

Reputation: 550

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..

Upvotes: 1

Don Roby
Don Roby

Reputation: 41137

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.

Upvotes: 9

Related Questions