Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Invalid
-
Affects Version/s: EE-1.8.2.GA_P04
-
Fix Version/s: EE-1.8.2.GA_P05
-
Component/s: ICE-Components
-
Labels:None
-
Environment:All
-
Assignee Priority:P1
-
Workaround Exists:Yes
-
Workaround Description:
Description
In a simple test case an ice:selectOneMenu is shown on the page. A command button is set to submit the form. If the page is loaded and button clicked without changing the value of the menu, the valueChangeListener is called.
When the value change listener is called, the getNewValue() method returns null instead of an empty string which it is initialized to.
When the value change listener is called, the getNewValue() method returns null instead of an empty string which it is initialized to.
With HTML forms, a lack of data entered is frequently submitted as:
form_field_name=
which means that it doesn't differentiate between no input and a string with no length. With select + option elements, we have the same issue where when an option has selected=selected, then the select is submitted as it's name = the selected option's value. If that option happens to have a value of a string with no length, then it's indistinguishable from no selection happening. As such, a string with no length is effectively a reserved sentinel value for no selection, and it's not proper application usage to take that value and re-use it for something else. In this case, the application is using it to indicate a selection of an option which it internally deems as a non-user-choice. We need to take care to avoid confusing non-selection and non-user-choice.
To fix this, we need to make use of another sentinel value to indicate this non-user-choice. Anything will do, and I have tested that a space works fine. I changed the selectItem thusly:
<f:selectItem itemValue=" " itemLabel="-" />
And also, we need to change what the bean property is initialised to, or else we'll still get a single errant ValueChangeEvent.
private String a = " ";