Hi WarnerJan,
It seems a bit odd at first but it makes sense. If the only values one can select are 0,1,2,3 then
there is no need to set the Select as required since the Select will always have a value.
If however the Select is set to required, then there should be an "nonselected" value for the user
to choose from. For the Select that value is an empty string. So normally one would use the
Option.EMPTY_OPTION:
Select select = new Select();
select.setRequired(true);
select.add(Option.EMPTY_OPTION);
select.add(...);
Or if you want to display a value for the "nonselected" value, do this:
Select select = new Select();
select.setRequired(true);
select.add(new Option("", "Please select a value..."));
select.add(new Option("M", "Male");
select.add(new Option("F", "Female");
See the Select Javadoc for more examples of the required property.
kind regards
bob
WarnerJan Veldhuis wrote:
Hi,
I have a set of values, 0 to 3 which I put in a Select, which is set to
be required. But the validate fails for the value zero. It says I must
select a value. Is that how it's supposed to work?
Cheers,
WarnerJan