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

    How to verify Confirm Password

    wingman zx Newbie


      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..




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


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

                                                                                                <rich:validator />




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




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

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

                                                                                                <rich:validator />




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





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




        • 2. Re: How to verify Confirm Password
          wingman zx Newbie

          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" />


                                                                      <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 />


                                                                      <rich:message for="conf" />


                                                            <h:commandButton value="Store changes"

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




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

          • 3. Re: How to verify Confirm Password
            Pavol Pitonak Master

            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
              Siva P Master

              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.



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


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

                                              <h:outputText value=":" />

                                                  <h:inputSecret id="reEnterpasswordField"


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

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

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



                                                                    <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:outputText value="*" />

                                                      <a4j:outputPanel id="p_reEnterpasswordField">

                                                         <h:message for="reEnterpasswordField"

                                                                        id="eReEnterpasswordField" />





              Thanks and Regards,