Wicket Drop down choice to set default value
Asked Answered
T

2

8

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"));
Tankard answered 16/11, 2011 at 10:44 Comment(0)
I
9

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.

Inlay answered 16/11, 2011 at 12:8 Comment(1)
+1 But don't forget about the customer.nullValid resource key when using setNullValid(true), which might be the one the OP is using ("successfully occured" seems like a valid null value)Morell
N
1

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..
Nobleminded answered 9/5, 2016 at 12:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.