How to set DropDown to only available choices (No Blank, No Choose One)?

2011-11-28 Thread eugenebalt
Easy question, but I forgot the answer.

I need my DropDown to
1) ONLY list the choices I have in my model (no blank, no 'Choose One'),
2) Automatically default to the 1st choice, so there is no blank visible.

If I do setNullValid(false) I see Choose One which is incorrect. I should
see the 1st item pre-selected.

If I do setNullValid(true) I see a blank option which is also incorrect.

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-set-DropDown-to-only-available-choices-No-Blank-No-Choose-One-tp4115842p4115842.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-h...@wicket.apache.org



Re: How to set DropDown to only available choices (No Blank, No Choose One)?

2011-11-28 Thread Martin Grigorov
Hi,

The javadocs says:
If set to false, then Choose One will be displayed when the value is
null. After a value is
 * selected, and that change is propagated to the underlying model,
the user will no longer see
 * the Choose One option, and there will be no way to reselect null
as the value.

so you need to set a default model too.
see org.apache.wicket.markup.html.form.DropDownChoice.DropDownChoice(String,
IModelT, List? extends T)
the second argument

On Mon, Nov 28, 2011 at 5:41 PM, eugenebalt eugeneb...@yahoo.com wrote:
 Easy question, but I forgot the answer.

 I need my DropDown to
 1) ONLY list the choices I have in my model (no blank, no 'Choose One'),
 2) Automatically default to the 1st choice, so there is no blank visible.

 If I do setNullValid(false) I see Choose One which is incorrect. I should
 see the 1st item pre-selected.

 If I do setNullValid(true) I see a blank option which is also incorrect.

 Thanks

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-to-set-DropDown-to-only-available-choices-No-Blank-No-Choose-One-tp4115842p4115842.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-h...@wicket.apache.org





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to set DropDown to only available choices (No Blank, No Choose One)?

2011-11-28 Thread eugenebalt
Yes, working. Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-set-DropDown-to-only-available-choices-No-Blank-No-Choose-One-tp4115842p4115957.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-h...@wicket.apache.org