selectOneListBox and why validation is not working on it
Hi,
I have a selectOneBox and my first item on the list is a default or a "Select One" text, but adding this, my validation doesn't work. I need this selectOneBox to be required and my error message is not coming up when I submit it with the "Select One" text as the choice.
Anyone know how to fix this?
thank you.
[340 byte] By [
KY8a] at [2007-11-26 18:41:44]

# 2
Do you have a custom validator or are you relying only on the required flag? If so, the required message only comes up, if the SelectOne is empty (eg. "")
So, if you insert the selectItem-Tag like this:
<selectOneMenu...>
<f:selectItem itemLabel="" itemValue=""/>
<f:selectItems...>
</selectOneMenu>
the required message should come up if you doesn't select an entry.
# 5
This is what I have in my code:
<h:selectOneListbox styleClass="selectOneListbox"
id="application" size="1" value="#{pc_Form.name.application}" required="true">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems
value="#{selectList.appList}">
</f:selectItems>
</h:selectOneListbox><h:message for="application" id="ApplicationError" styleClass="messageError">
But submitting still won't give me an error, even with the first choice selected.
?
Message was edited by:
KY8
KY8a at 2007-7-9 6:15:44 >

# 8
Sorry, but I don' know RAD7.But change your code so that "Select One" is replaced bei "" (empty string) or if you are fixed on the string, implement a custom validator (like BalusC mentioned before)...