Primefaces password match on blur always validation error

1k views Asked by At

Using primefaces password tag, I want to use the match as shown in the show case but with on blur validation, I use the following code:

<h:form id="formulaire">
    <p:growl id="growl" showDetail="true" autoUpdate="true" />

    ...

    <p:password id="pwd1" value="#{registrationBean.user.password}"
        size="47" label="Password" required="true"
        placeholder="Password*" >
        <f:validateLength minimum="6" />
        <p:ajax event="blur"/>
    </p:password>
    <br />
    <p:password id="pwd2" value="#{registrationBean.user.password}"
        size="47" label="Verification" required="true"
        placeholder="Verification*" match="pwd1">
        <p:ajax event="blur"/>
    </p:password>
    <br/>
    <p:commandButton action="#{registrationBean.register}" value="register"/>


</h:form>

I use the match on the verification, to avoid displaying the error message before trying to reproduce it. the problem is that growl always displays the error message. Even when I put the match on the first field, the growl error keeps showing. Thank you for your help.

Edit:

The Best solution I managed to get is the following:

<p:password id="pwd1" value="#{registrationBean.password}"
    size="47" label="Password" required="true"
    placeholder="Password*" match="pwd2">
    <f:validateLength minimum="6" />
</p:password>
<br />
<p:password id="pwd2" value="#{registrationBean.password}"
    size="47" label="Verification" required="true"
    placeholder="Verification*" >
    <p:ajax process="pwd1 pwd2" event="blur"/>
</p:password>

the draw back is that there is no ajax verification after password is entered (length...), this is done only once the verification is entered. (still looking for a better solution)

0

There are 0 answers