My validator seem to resume to false once I'm not in the field anymore, why is that ? I thought it was because everytime I blur a field a new request is made thus losing the data of validators but I'm not sure it's the case.
I've visual icons that reflect if the validation of a field passed. However when one of my validation test passed the submit button is available, not when all of them passed. Even though you can see at the bottom of the picture that the result of the condition is false. Which is odd because it's the exact same condition reversed.
for example here you see every field validation passed indicated by the green icon, (the submit button is available but it would have been available as soon as 1 field test passed). And under the submit button is the values of the different validators.
<p:commandButton value="Submit" id="submit" action="#{subscribeUser.inscrireUser}" icon="ui-icon-disk"
disabled="#{(!usernameValidator.ok and !passwordValidator.ok and !emailValidator.ok)}" />
and here are some fields:
<tr><td>
<h:outputLabel for="username">#{registering.Username}: </h:outputLabel></td><td>
<p:inputText id="username" value="#{subscribeUser.user.username}"
validator="#{usernameValidator.validate}">
<f:passThroughAttribute name="required" value="true"/>
<f:ajax event="blur" render="usernameCheck usernameMessage submit vals"></f:ajax>
</p:inputText></td><td>
<h:panelGroup id="usernameCheck">
<h:graphicImage library="images/icons" name="failed_indicator.png" rendered="#{usernameValidator.isIndicatorVisible.usernameFailed}"></h:graphicImage>
<h:graphicImage library="images/icons" name="success_indicator.png" rendered="#{usernameValidator.isIndicatorVisible.usernameSuccess}"></h:graphicImage>
</h:panelGroup></td><td>
<span class="error"><h:message id="usernameMessage" for="username"/></span></td>
</tr>
<tr><td>
<h:outputLabel for="email">#{registering.Email}: </h:outputLabel></td><td>
<p:inputText id="email" required="true" value="#{subscribeUser.user.email}"
validator="#{emailValidator.validate}"
requiredMessage="#{registering.reqEmail}">
<f:passThroughAttribute name="required" value="true"/>
<f:passThroughAttribute name="type" value="email"/>
<f:passThroughAttribute name="maxlength" value="100"/>
<f:ajax event="blur" render="emailCheck emailMessage submit vals"></f:ajax>
</p:inputText></td><td>
<h:panelGroup id="emailCheck">
<h:graphicImage library="images/icons" name="failed_indicator.png" rendered="#{emailValidator.isIndicatorVisible.emailFailed}"></h:graphicImage>
<h:graphicImage library="images/icons" name="success_indicator.png" rendered="#{emailValidator.isIndicatorVisible.emailSuccess}"></h:graphicImage>
</h:panelGroup> </td><td>
<span class="error"><h:message id="emailMessage" for="email"/></span></td>
</tr>
When using this:
<p:commandButton value="Submit" id="submit" action="#{subscribeUser.inscrireUser}" icon="ui-icon-disk"
disabled="#{(!usernameValidator.ok and !passwordValidator.ok and !emailValidator.ok)}" />
<h:outputText id="vals" name="vals" value="#{usernameValidator.ok} and #{passwordValidator.ok} and #{emailValidator.ok}
= #{usernameValidator.ok and passwordValidator.ok and emailValidator.ok}"></h:outputText>
When blurring a field, the correct value of the field validation is put, but others automatically change to false. Why is that happening ?