We had a problem with a SelectOneChoice that had the required attribute set to true, but it never threw an error once the form was submitted. It turns out that LOV settings on the View Object were causing the problem. There is a checkbox to include a "No Selection" item.
Checking this box causes an empty space to be represented in the dropdown list. This means that a empty string is a selectable value. Since this is not the same as null, if it is the selected value, it considers this as fulfilling the requirement for a value to be selected. If you leave this checkbox unchecked, and do not set the value of the selectOneChoice when it is initially rendered, then you can have the selectOneChoice show up initially with no value showing/selected, and then if the user submits, they will get an error stating the a value must be selected. Also, you get the benefit of not being able to select a blank value, because as soon as the user selects a value, the blank is gone.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment