Read about jquery multi step form with validation, The latest news, videos, and discussion topics about jquery multi step form with validation from alibabacloud.com
JQ Code
The code is as follows
Copy Code
/*** @author Ming*/$ (document). Ready (function () { /* Set DEFAULT Properties * *$.validator.setdefaults ({Submithandler:function (form) {Form.submit ();}}); Character validationJQuery.validator.addMethod ("Stringcheck", function (value, Element) {return this.optional (Element) | | /^[u0391-uffe5w]+$/.test (value);"Can only include Chinese characters, English letters, numbers and u
the name, email, subject, and Message fields:
We add a style named Easyui-validatebox to the input tag, so the input tag will apply validation based on the Validtype attribute.Block form submission When the form is invalid
When the user clicks the Submit button for the form, if the
Finishing the front-end JS notes the first article!Form form Submission$ (". Submit"). Removeattr. (' onclick '); $ (' [name= ' form table sole name "]"). Submit;Gets the ID of input$ (' #id '). Val ();Get the name of input$ (' [name= ' name value '] '). Val ();Each method matches the function specified by the element for each element$ ("Li"). each (function ())
FormPluginAPI provides many useful methods for you to easily process the data and form submission processes in the form, this article introduces the formDdata parameter validation form of the jQueryform plug-in and the related knowledge of submitting after verification, if you are interested, let's take a look at it. T
Easyui The validation box inside the form forms to explain the next Validatebox class and related properties.
Validation rules
Validation rules are defined by using the required and Validtype attributes, and here are the rules that have been implemented:
Email: matching email regular expression rules, system-provide
This section of the code to give a simple form validation instance, is to determine whether the input box is empty, you can follow this principle, to join the regular expression judgment, to achieve a variety of powerful forms validation functionWeb portal Source CodeThis fragment is from http://www.huiyi8.com/webyuanma/menhu/
WordPress, of course, there are forms of verification, but we all know that the user experience is not good, the page jumps, and sometimes the form will be emptied, and the front desk form certification seems very necessary. The following is my written by changing the text box background color prompts the user input content, WordPress as long as the following code into the JS file can work. The
In the form verification, if the form information is more, resulting in the Submit button and error message is not displayed on the screen, it will be unable to submit, and no friendly prompt question.The ideal solution is to automatically locate the error prompt when the error is verified, so that the user can view and modify it.$ ("#Send"). Click (function (e) { //This line is opera's patch, less i
FormPluginAPI provides many useful methods for you to easily process the data and form submission processes in the form, this article introduces the formDdata Parameter validation form of the jQueryform plug-in and the related knowledge of submitting after verification, if you are interested, let's take a look at it. T
Obviously, this will improve the user experience.
HTML code:
Copy Code code as follows:
jquery Code:
Copy Code code as follows:
OK, now let's analyze the jquery statements in detail.
Look at the statement of the DOM action first
$ (' form:input ') This is the Similarly, there are $ (': Text '), $ (': CheckBox '), and so on. As long as you understand that only i
HTML section:
jquery section:
Above this jquery simple form verification example is small series share to everybody's content, hope can give everybody a reference, also hope everybody support cloud habitat community.
This example describes the jquery implementation of the form step process navigation. Share to everyone for your reference. Specifically as follows:jquery form Step Process navigation is a multi-
credit card number.", Equalto:"Please enter the same value again.", Accept:"Please enter a value with a valid extension.", MaxLength: $.validator.format ("Please enter no more than {0} characters."), minlength: $.validator.format ("Please enter at least {0} characters."), Rangelength: $.validator.format ("Please enter a value between {0} and {1} characters long."), Range: $.validator.format ("Please enter a value between {0} and {1}."), Max: $.validator.format ("Please enter a value of less tha
123456789 $ the the the the - for= "username" > Username: in the the About for= "email" > Email: the the the + for= "Personinfo" > Profile: - theBayi the the - - the thejquery form Validation
$.get and $.post methods, the first argument is the address, the second is the passed value, and the third is the successful callback functionPost method:
The code is as follows
Copy Code
function Emailb () {var email = $ ("#email"). Val ();if (email== "") {$ ("#inf_email"). ReplaceWith (' }else{$.post ("/index.php/index/checkemail2", {"email": Email, "randnum": math.random () + "},function(RES) {if (res== ' 1 ') {$ ("#inf_email"). ReplaceWith (' }else{$ ("#inf_email"
Form verification has been very cumbersome, especially the larger form, if each input to write the verification of the individual is simply to write the dead, recently wrote a small paragraph of JS Unified verification of the content of the form is correct.
Using this code will no longer need to judge each input write format, just the correct format of the regul
As a programmer, in the solution of problems encountered in the work, do some summary is necessary, not only easy to summarize the relevant knowledge points, but also for the vast number of programmers to provide some work experience, to give the peer side Ming.
HTML section:
The above content is a small series to introduce the jquery formvalidator form verification related knowledge, hope to hel
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.