Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Operating System: Windows XP
Platform: PC
Description
The Wells-Fargo demo located at repo\applications\wells-fargo has an
ice:selectOneMenu used to select the U.S. State. Currently, it defaults to
the first state, but we would like it to have an initial value of nothing with
the required="true" attribute on the component to force someone to select a
state.
At this point in time, adding an initial SelectItem with the value of an empty
String will not fire the required="true" validator and initializing the first
SelectItem to nothing will give it a null value and fire a ValidationError:
Value is not valid.
For testing purposes, you can add an initial entry with an empty String to the
application by going to the Criteria class, removing the current
initialization of the US_STATE_LIST and adding these two lines to the static
block:
US_STATE_LIST = new ArrayList(LocationLists.getUsStatesListSize()+1);
US_STATE_LIST.add(0,new SelectItem(""));
What we would like to do is add an empty initial SelectItem that would then
fire the required="true" validator on the component. Please refer to ICE-873
which was previously supposed to have resolved this issue.
ice:selectOneMenu used to select the U.S. State. Currently, it defaults to
the first state, but we would like it to have an initial value of nothing with
the required="true" attribute on the component to force someone to select a
state.
At this point in time, adding an initial SelectItem with the value of an empty
String will not fire the required="true" validator and initializing the first
SelectItem to nothing will give it a null value and fire a ValidationError:
Value is not valid.
For testing purposes, you can add an initial entry with an empty String to the
application by going to the Criteria class, removing the current
initialization of the US_STATE_LIST and adding these two lines to the static
block:
US_STATE_LIST = new ArrayList(LocationLists.getUsStatesListSize()+1);
US_STATE_LIST.add(0,new SelectItem(""));
What we would like to do is add an empty initial SelectItem that would then
fire the required="true" validator on the component. Please refer to ICE-873
which was previously supposed to have resolved this issue.
Activity
Field | Original Value | New Value |
---|---|---|
issue.field.bugzillaimportkey | 1170 | 12395 |
Assignee | Adnan Durrani [ adnan.durrani ] |
Support Customer Ref. #s | 725 |
Fix Version/s | 1.6 [ 10031 ] | |
Assignee Priority | P3 | |
Assignee | Adnan Durrani [ adnan.durrani ] |
Assignee Priority | P3 | P1 |
Assignee | Adnan Durrani [ adnan.durrani ] | Mircea Toma [ mircea.toma ] |
Assignee | Mircea Toma [ mircea.toma ] | Adnan Durrani [ adnan.durrani ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Resolved [ 5 ] |
Fix Version/s | 1.6DR#5 [ 10071 ] | |
Fix Version/s | 1.6 [ 10031 ] | |
Resolution | Fixed [ 1 ] |
Resolution | Fixed [ 1 ] | |
Status | Resolved [ 5 ] | Reopened [ 4 ] |
Status | Reopened [ 4 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Attachment | sample-icefaces-sun-portlet.war [ 10453 ] |
Resolution | Fixed [ 1 ] | |
Status | Resolved [ 5 ] | Reopened [ 4 ] |
Assignee Priority | P1 | P2 |
Fix Version/s | 1.6 [ 10031 ] | |
Fix Version/s | 1.6DR#5 [ 10071 ] |
Status | Reopened [ 4 ] | Resolved [ 5 ] |
Assignee Priority | P2 | |
Resolution | Fixed [ 1 ] | |
Assignee | Adnan Durrani [ adnan.durrani ] |
Resolution | Fixed [ 1 ] | |
Status | Resolved [ 5 ] | Reopened [ 4 ] |
Assignee Priority | P1 | |
Assignee | Adnan Durrani [ adnan.durrani ] |
Status | Reopened [ 4 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Fix Version/s | 1.6DR#6 [ 10090 ] | |
Fix Version/s | 1.6 [ 10031 ] |
Fix Version/s | 1.6 [ 10031 ] |
Status | Resolved [ 5 ] | Closed [ 6 ] |
Assignee Priority | P1 | |
Assignee | Adnan Durrani [ adnan.durrani ] |
I am experiencing the same problem with 1.5.3.
To be more precise, I'm building my select item list like this:
ArrayList<SelectItem> selectItemList = new ArrayList<SelectItem>();
selectItemList.add(new SelectItem("", "-- Select --"));
Now, this generates HTML that looks like this:
<select>
<option value="">-- Select --</option>
</select>
When the user does not select an item from the list (leaves it as "-- Select -
"), the com.icesoft.faces.component.ext.HtmlSelectOneMenu.validate(FacesContext facesContext) method calls the UIInput.getSubmittedValue() method, which, rather than returning an empty string (""), returns "- Select -"!!! This is the heart of the problem. Perhaps it is the ICEfaces partial-submit system passing "- Select --" as a request parameter value. I don't know.The reason why the "Validation Error: Value is not valid" message is happening, is because the HtmlSelectOneMenu.validate() sees "-- Select -
" instead of an empty string for the submitted value, and then lets the UISelectOne superclass handle it. The superclass does not see "- Select --" as a valid value in the selectitems, and so adds a javax.faces.component.UISelectOne.INVALID message to the validation error list, the English version of which is "Validation Error: Value is not valid"– Neil