4 Replies Latest reply on Feb 8, 2013 4:03 AM by sivaprasad9394

    How to verify Confirm Password

    laxman9

      Hi

      How to verify Confirm Password, i want to verify the password and confirm password fields once both the fields entered, before submitting submit button.

       

      Please suggest ...here is the code..

       

      <table>

      <tr>

                                                                            <td colspan="2" class="textline1"> Password:</td>

                                                                            <td>

                                                                            <h:inputSecret id="psd" value="#{regBean.password}" styleClass="psdwrd">

                                                                                                <rich:validator />

                                                                                      </h:inputSecret></td>

                                                                  </tr>

      <tr>

                                                                            <td colspan="2" class="textline2"><rich:message for="psd" /></td>

                                                                  </tr>

       

                                                                  <tr>

                                                                            <td colspan="2" class="textline1">Confirm Password:</td>

                                                                            <td><h:inputSecret id="confmPsd" value="#{regBean.confirmPassword}" styleClass="psdwrd">

                                                                                                <rich:validator />

                                                                                      </h:inputSecret></td>

                                                                  </tr>

        <tr>

                                                                            <td colspan="2" class="textline2"><rich:message for="confmPsd" />

                                                                            </td>

                                                                  </tr>

       

        <tr>

                                                                            <td colspan="2"><a4j:commandButton value="Submit" action="#{regBean.saveUser}" /></td>

                                                                  </tr>

       

      </table>

        • 1. Re: How to verify Confirm Password
          ppitonak
          • 2. Re: How to verify Confirm Password
            laxman9

            Thanks for the reply Palo,

            I tried Graphivalidator with the below code, it's working fine when i submit button

             

            <h:form id="form2">

                                          <rich:graphValidator value="#{validationSampleMBean}" id="gv">

               <rich:messages for="gv" />

                                                              <rich:messages globalOnly="true" />   

                                                                        <h:outputText value="Enter new password:*" />

                                                                        <h:inputSecret value="#{validationSampleMBean.password}" id="pass">

                                                                        <a4j:ajax event="keyup"  render="password" />

                                                                        </h:inputSecret>

                                                                        <rich:message for="pass" />

             

                                                                        <h:outputText value="Confirm the new password:" />

                                                                        <h:inputSecret value="#{validationSampleMBean.confirmpassword}" id="conf">

                                                                         <a4j:ajax event="keyup"  render="confirmpassword" />

                                                                        <rich:validator />

                                                                        </h:inputSecret>

                                                                        <rich:message for="conf" />

              

                                                              <h:commandButton value="Store changes"

                                                                        action="#{validationSampleMBean.addUser}" />

                                          </rich:graphValidator>

                                </h:form>

             

            And the other problem........Graphivalidator is not working with html table, i tried it

            • 3. Re: How to verify Confirm Password
              ppitonak

              Hi, we tested graph validator inside tables so it should work. Could you please provide some code snippet?

              • 4. Re: How to verify Confirm Password
                sivaprasad9394

                Hi Wingman,

                 

                Do like below in the 2 nd text box(Re Enter Password Field:).Here once you enter the confirm password field and click out side in the screen onblur will get executed and back end comparision will be done.

                 

                <a4j:region>

                         <h:panelGrid columns="5" border="0"

                                                        columnClasses="fieldLabel,fieldColon,fieldData,fieldError,fieldErrorNone">

                                           <h:outputText value="#{msg.reEnterPassword}" />

                                                <h:outputText value=":" />

                                                    <h:inputSecret id="reEnterpasswordField"

                                                            value="#{bean.field}"

                                                            required="true" requiredMessage="#{msg.requiredField}"

                                                            styleClass="celcom01" size="28" maxlength="15">

                                                                      <f:validateLength minimum="#{msg.passwordMin}"

                                                                               maximum="#{msg.passwordMax}">

                                                                      </f:validateLength>

                                                                      <a4j:support event="onblur"

                                                                         actionListener="#{urBean.passwordActionforComparingIt}" // This is listener befor clicking the action button ajaz request works for comparing password.

                                                                          reRender="p_reEnterpasswordField,eReEnterpasswordField" //This nothing but displaying error message for the password re entered is wrong.

                                                                          limitToList="true" />

                                                     </h:inputSecret>

                                                        <h:outputText value="*" />

                                                        <a4j:outputPanel id="p_reEnterpasswordField">

                                                           <h:message for="reEnterpasswordField"

                                                                          id="eReEnterpasswordField" />

                                                        </a4j:outputPanel>

                                                    </h:panelGrid>

                                                </a4j:region>

                 

                Thanks and Regards,

                Siva