/Dropdownchoice-without-default-option-choose-one-tp1866175p4668398.html
Sent from the Users forum mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users
I would like to remove the default choose one option from the
DropDownChoice component.
Does anyone know how to do this. Thanks.
--
View this message in context:
http://www.nabble.com/Dropdownchoice-without-default-option-%22choose-one%22-tp17782776p17782776.html
Sent from the Wicket - User
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));
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)).
I have noticed that with DropDownChoice, if the currently selected
value is Null, you get this choose one item. And sometimes in a
dynamic situation you get it still.
Try using the analogous ListChoice element, at least it worked for me.
**
Martin
2008/6/11 nitinkc [EMAIL PROTECTED]:
I tried
On Wed, 11 Jun 2008, Martin Makundi wrote:
I have noticed that with DropDownChoice, if the currently selected
value is Null, you get this choose one item. And sometimes in a
dynamic situation you get it still.
Yeah, it's easy to miss setting the currently selected value
for when DropDownChoice
Yeah, it's easy to miss setting the currently selected value
for when DropDownChoice is rendered for the first time.
Hence it's always a good idea to supply it in the
constructor.
I have noticed the problem when I have a propertymodel attached to the
dropdown, and I have two chained dropdowns
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. */
If you use ListChoice this option is not there. ListChoice does not
extend AbstractSingleSelectChoice .
**
Martin
2008/6/11 Michael O'Cleirigh [EMAIL PROTECTED]:
Hi nitinkc,
The Choose One option is actually defined in:
public abstract class AbstractSingleSelectChoice extends AbstractChoice
Just to summarise, you need to do two things: set a 'current selection' and
call setNullValid(false).
/Gwyn
On Wed, Jun 11, 2008 at 6:14 PM, nitinkc [EMAIL PROTECTED] wrote:
I would like to remove the default choose one option from the
DropDownChoice component.
Does anyone know how to do
Thanks gwyn!
I was not adding the default value to the ddc and that's why it was showing
the choose one option. As you said, it's best to do that in the
constructor.
Gwyn wrote:
Just to summarise, you need to do two things: set a 'current selection'
and
call setNullValid(false).
/Gwyn
11 matches
Mail list logo