Hi nitinkc,

The "Choose One" option is actually defined in:
public abstract class AbstractSingleSelectChoice extends AbstractChoice
{
   /**
    *
    */
   private static final long serialVersionUID = 1L;

/** String to display when the selected value is null and nullValid is false. */
   private static final String CHOOSE_ONE = "Choose One";
.
.
.


You should look at overriding this method:

protected CharSequence getDefaultChoice(final Object selected) in AbstractSingleSelectionChoice

It looks to me like if you return EMPTY_STRING then no default choice will be rendered into the options list.


Mike

I tried setNullValid(false). But this does not get rid of the "choose one"
option. Note that the choices are a list of Strings. If the choices are a
list of other user defined object types and I use a choicerendrer for
display values, the "choose one" option is removed(without
setNullValid(false)). Any ideas?


Michael O'Cleirigh wrote:
Hi nitinkc,

Calling setNullValid (false) on the drop down choice should get rid of the default "choose one" text.

If the ddc model should always have a value defined then you could set the model object to be for example the first choice.

e.g. ddc.setModelObject (ddc.getChoices().get(0));

Regards,

Mike

I would like to remove the default "choose one" option from the
DropDownChoice component.
Does anyone know how to do this. Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to