Use of JSF Tag verifier

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.