For a simple html page like this:
<form action="success.html" >
<input type="text" value="SomeValue" onchange="this.form.submit()"/>
<input type="submit" value="Submit"/>
</form>
Any change of the value results in auto-submit of the form to navigate to success.html
Consider the following snippet in JSF 2.x:
<h:form >
<h:panelGrid columns="3">
<h:outputLabel value="Name: " />
<h:inputText id="inputname" binding="#{zipAutoFill.inputName}"
required="true"/>
<h:message for="inputname"/>
<h:outputLabel value="Zip Code: " />
<h:inputText id="inputzip"
binding="#{zipAutoFill.inputZip}"
valueChangeListener="#{zipAutoFill.zipAutoFillListener}"
onchange="this.form.submit()"/>
<h:message for="inputzip"/>
<h:outputLabel value="City: " />
<h:inputText id="inputcity" binding="#{zipAutoFill.inputCity}" />
<h:message for="inputcity"/>
<h:outputLabel value="State: " />
<h:inputText id="inputstate" binding="#{zipAutoFill.inputState}" />
<h:message for="inputstate"/>
<h:commandButton id="submitbutton" value="Submit" action="page02"/>
</h:panelGrid>
</h:form>
Based on the zip code filled in by the user(and so resulting in a change of value), the fields city and state will accordingly be populated.
However, after auto-submit, it doesn't navigate to page02.xhtml
. What am I missing?