When validation fails, p:inputText retains the submitted value, but the p:selectOneMenu returns to null/default/old-value.
Code: Select all
<p:messages/>
<h:panelGrid columns="3">
<h:outputLabel for="type" value="Type:"/>
<p:selectOneMenu id="type" value="#{controller.feature.type}">
<f:selectItems value="#{controller.featureTypes}"/>
</p:selectOneMenu>
<p:message for="type"/>
<h:outputLabel for="value" value="Value:"/>
<p:inputText id="value" value="#{controller.feature.value}"/>
<p:message for="value"/>
</h:panelGrid>
<p:commandButton value="Submit"
action="#{controller.saveFeature}"
update=":form:panel :form:edit"
process="edit"
ajax="false"/>
Algorithm works as follows;
- If it's an input component, submitted value is checked first since it'd be the value to be used in case validation errors terminates jsf lifecycle
- Finally the value of the component is retrieved from backing bean and if there's a converter, converted value is returned
- If the component is not a value holder, toString of component is used to support Facelets UIInstructions.
This works by invoking getSubmittedValue on the UIComponent (defined by EditableValueHolder interface).
OTOH SelectOneMenuRenderer makes does not appear to make any use of submitted value. With a debugger I see that submittedValue of SelectOneMenu UIComponent is set correctly, but apparently nothing uses it.
Is this a bug? Is there any work-around?
[primefaces 3.0.M4-SNAPSHOT]