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"));
apaderno
  • 28,547
  • 16
  • 75
  • 90
Nitin4Android
  • 864
  • 2
  • 12
  • 25

2 Answers2

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.

Don Roby
  • 40,677
  • 6
  • 91
  • 113
  • 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) – Xavi López Nov 17 '11 at 09:49
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..