Let me take another stab at explaining my use case, in hopes of determining
why validation is firing for the submitted values.  I read something about
Options not being valid if they aren't in the "master" list, specified by
the value attribute of <h:selectManyListbox>, and wanted to figure out if
that is what's happenign in my case.

Components:
US State radios [selectOneRadio]
availableLocations [selectManyListbox]
selectedLocations [selectManyListbox]

Data Model:
globalLocations - global list of all locations for all states
availableLocations - state-specific subset of globalLocations
selectedLocations - locations the user has chosen, regardless of state

Use Case:
1.  On load, selectedLocations is populated with locations already
associated with the user
2.  User selects one of the "US State" radios to retrieve
availableLocations, a state-specific subset of globalLocations (this works
fine) 
3.  User selects one of availableLocations, which is added to
selectedLocations. (this works fine)
4.  User can choose to remove a selectedLocation by double clicking on it. 
Need to update the model in this case, so JavaScript selects all
selectedLocations and submits the form.
5.  User submits the form, to update his selectedLocations

Relevant Code:
<%-- STATE RADIO BUTTONS --%>
<h:selectOneRadio immediate="true" id="stateRadios"
        onclick="submit()"
valueChangeListener="#{editProfileAction.processStateChange}"
        styleClass="bodyCopy">
        <f:selectItem itemLabel="MA" itemValue="MA"/>
        <f:selectItem itemLabel="ME" itemValue="ME"/>
        <f:selectItem itemLabel="NH" itemValue="NH"/>
        <f:selectItem itemLabel="RI" itemValue="RI"/>
        <f:selectItem itemLabel="VT" itemValue="VT"/>
</h:selectOneRadio>
<%-- AVAILABLE LOCATIONS --%>
<h:selectManyListbox id="availableLocations" size="11"
styleClass="selectBox"

ondblclick="fnDualSelectChoice1('alertsSubView:alertsForm','alertsSubView:alertsForm:availableLocations',
'alertsSubView:alertsForm:userLocations',
'alertsSubView:alertsForm:stateRadios');return false;">
        <f:selectItems value="#{availableLocations}"/>
</h:selectManyListbox>
<%-- SELECTED LOCATIONS --%>
<h:selectManyListbox immediate="true" id="userLocations"
        size="11" styleClass="selectBox"
        valueChangeListener="#{editProfileAction.updateUserLocations}"

ondblclick="fnDualSelectChoice2('alertsSubView:alertsForm','alertsSubView:alertsForm:userLocations',
'alertsSubView:alertsForm:availableLocations',
'alertsSubView:alertsForm:stateRadios');fnSelectAllValues('alertsSubView:alertsForm','alertsSubView:alertsForm:userLocations');submit();">
        <f:selectItems value="#{editProfileAction.userLocations}"/>
</h:selectManyListbox>
<%-- SAVE BUTTON --%>
<h:commandButton immediate="true" id="save" type="submit" value="Save Alerts
& Searches" action="#{editProfileAction.saveAlertsAndSearch}"
styleClass="formButtonXL"
onclick="fnSelectAllValues('alertsSubView:alertsForm','alertsSubView:alertsForm:userLocations');"/>

The behavior I'm seeing is that when the user removes the value from
selectedLocations (Step 4):
1.  The value is removed via JavaScript (expected)
2.  All the userLocation values are selected (expected)
3.  The form is submitted (expected)
4.  For every value the user added on the client, I get this message:
"Validation Error "userLocations": Value is not a valid option."

>From everything that I have read, and my interpretation thereof, this
validation shouldn't be happening due to immediate="true".  I'm sure there
is a valid explanation for this error, I'm just ignorant of it at this
point.  Does anyone have any insight?

Sorry for the long winded post.  This is a pretty rare and somewhat complex
requirement.



-- 
View this message in context: 
http://www.nabble.com/Converter-error-tf2564573.html#a7160507
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to