I have a js-function codeAddress() that processess the data from address and updates the values of fullAddress and validField.
I tried <p:ajax> to pass the data of fullAddress and validField to the backing bean, but the setter methods seem to get called one request delayed.
<h:form id="addressForm">
<p:inputText id="address">
<p:ajax onstart="codeAddress()" process="fullAddress validField"/>
</p:inputText>
<p:commandButton value="submit" />
<p:inputText id="fullAddress" value="#{addressBean.fullAddress}" />
<p:inputText id="validField" value="#{addressBean.valid}" />
</h:form>
The
onstartis invoked right before the ajax request is about to be sent. At that moment the ajax request is already prepared for long. It’s thus too late to let it to take the changed input values into account.Better use the input component’s
onchangeattribute instead. It’s invoked before the ajax request is to be prepared.