JSF Authenticator + Regular expression authentication password, two times password is consistent function.
Requirements Description :
1, Password and confirmation display (consisting of 10-15 letters or numbers)
2, two times password inconsistent when prompted after confirming the password
3. After you change the content, verify that you are prompted by a second message (consisting of 10-15 letters or numbers )
Implementation code
1, page code
<span style= "FONT-SIZE:18PX;" >
The Patten content in the Validateregex tag is, verifies the content format entered by the current text box, Validatormessage indicates the content displayed when the validation fails, the font is red, and onblur is the JS method that starts after losing focus.
The rich:message tag is the label of the prompt information on the interface, which binds to the password box.
2,js method
<span style= "FONT-SIZE:18PX;" >function Check () {//Get the password after the message var passwd = document.getElementById ("userform:passwordmsg");//Determine if it is Firefox if ( Window.navigator.userAgent.toLowerCase (). IndexOf (' Firefox '!=-1) {if (passwd.textcontent== "") {Passwd.style.color = "Groy";p asswd.textcontent= "consists of 10-15 letters or numbers";}} Else{if (passwd.innertext== "") {passwd.style.color= "Groy";p asswd.innertext= "consists of 10-15 letters or numbers";}}} </span>
<span style= "FONT-SIZE:18PX;" >function checkpswd () {//Get password, confirm password and Confirm password after message var pswd = document.getElementById ("userform:pswd"); var repswd = document.getElementById ("userform:repswd"); var repasswd = document.getElementById ("userform:repasswordmsg");// Determine if the password is consistent if (Pswd.value!=repswd.value) {//Set prompt information is, password inconsistent repasswd.style.color= "red"; if ( Window.navigator.userAgent.toLowerCase (). IndexOf (' Firefox '!=-1) {repasswd.textcontent= "password inconsistent";} else{repasswd.innertext= "Password Inconsistent";}} else{//set the prompt information to be composed of 10-15 letters or numbers repasswd.style.color= "gray"; if (Window.navigator.userAgent.toLowerCase (). IndexOf (' Firefox '!=-1) {repasswd.textcontent= "consists of 10-15 letters or numbers";} Else{repasswd.innertext= "consists of 10-15 letters or numbers";}}} </span>
Use of JSF Tag verifier