An example of jquery validation plug-in Form Verification
Source: Internet
Author: User
Messages_cn.js <! -- Verify internationalization, Chinese --> (if messages_cn.js is not referenced, It is a prompt in English and Chinese is used)
CopyCode The Code is as follows: required: "This field is required .",
Remote: "Please fix this field .",
Email: "Please enter a valid email address .",
URL: "Please enter a valid URL .",
Date: "Please enter a valid date .",
Dateiso: "Please enter a valid date (ISO ).",
Datede: "bitte geben Sie ein gültiges datum ein .",
Number: "Please enter a valid number .",
Numberde: "bitte geben Sie eine nummer ein .",
Digits: "Please enter only digits ",
Creditcard: "Please enter a valid credit card number .",
Failed to: "Please enter the same value again .",
Accept: "Please enter a value with a valid extension
Maxlength: Please enter no more than {0} characters
Minlength: Please enter at least {0} characters
Rangelength: Please enter a value between {0} and {1} characters long.
Range: Please enter a value between {0} and {1 }.
MAX: Please enter a value less than or equal to {0 }.
Min: Please enter a value greater than or equal to {0 }.
<SCRIPT type = "text/JavaScript">
$ (Function (){
$ ("# Btnok"). Click (function (){
$ ("# Form1"). Validate ({rules :{
Username: {required: True, minlength: 2 },
Email: {required: True, email: true },
URL: {required: True, URL: true },
Comment: "required"
}
});
});
});
</SCRIPT>
<Body>
<Form ID = "form1" runat = "server" Action = "" method = "get">
<Fieldset>
<Legend> A simple verification example with verification comments </legend>
<P>
<Label for = "cusername"> name </label> <em> * </em>
<Input type = "text" id = "cusername" name = "username" size = "25"/>
</P>
<P>
<Label for = "cemail"> email </label> <em> * </em>
<Input type = "text" id = "cemail" name = "email" size = "25"/>
</P>
<P>
<Label for = "curl"> URL </label> <em> * </em>
<Input type = "text" id = "curl" name = "url" size = "25"/>
</P>
<P>
<Label for = "cComment"> your comment </label> <em> * </em>
<Textarea id = "cComment" name = "comment" Cols = "22"> </textarea>
</P>
<P>
<% -- <Input type = "Submit" id = "send" value = "Submit"/> -- %>
<Asp: button id = "btnok" runat = "server" text = "Submit" onclick = "btnok_click"/>
</P>
</Fieldset>
</Form>
</Body>
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