jquery form Front End JS verification

Source: Internet
Author: User
The code is as follows Copy Code
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> User Registration </title>
<script type= "Text/javascript" src= "Http://a.tbcdn.cn/s/kissy/1.2.0/kissy-min.js" ></script>
<body>
<div class= "Register" >
<div class= "title" > User Registration </div>
<form action= "Member.php?mod=register&do=doregister" method= "post" name= "id=" Reg_form ">
<table class= "Regtab" >
<tr>
&LT;TD class= "R" ><span>*</span> account: </td><td class= "L" ><input type= "text" Name= " Username "id=" username "/></td><td></td>
</tr>
<tr>
&LT;TD class= "R" ><span>*</span> Password: </td><td class= "L" ><input type= "password" name= " PWD "id=" pwd "/></td><td></td>
</tr>
<tr>
&LT;TD class= "R" ><span>*</span> Confirm password: </td><td class= "L" ><input type= "password" name= " Rpwd "id=" Rpwd "/></td><td></td>
</tr>
<tr>
&LT;TD class= "R" ><span>*</span> real name: </td><td class= "L" ><input type= "text" Name= " Realname "id=" Realname "/></td><td></td>
</tr>
<tr>
&LT;TD class= "R" > Sex:</td>
&LT;TD class= "L" >
<select name= "Sex" >
<option value= "s" > Privacy </option>
<option value= "F" > Female </option>
<option value= "M" > Male </option>
</select>
</td>
<td></td>
</tr>
<tr>
&LT;TD class= "R" >email:</td><td class= "L" ><input type= "text" name= "email" id= "email"/></td ><td></td>
</tr>
<tr>
&LT;TD class= "R" > Birth date: </td><td class= "L" ><input type= "text" name= "birdate" id= "Birdate"/></ Td><td></td>
</tr>
<tr>
&LT;TD class= "R" > School: </td><td class= "L" ><input type= "text" Name= "School"/></td><td ></td>
</tr>
<tr>
&LT;TD class= "R" > class: </td><td class= "L" ><input type= "text" Name= "class"/></td><td ></td>
</tr>
<tr>
&LT;TD class= "R" > School details Address: </td><td class= "L" ><input type= "text" name= "saddress"/></td> <td></td>
</tr>
<tr>
&LT;TD class= "R" > Profile: </td><td class= "L" ><textarea name= "Intro" ></textarea></td> <td></td>
</tr>
<tr class= "n" >
<td></td><td><input type= "Submit" Name= "Sub1" value= "submitted"/> &nbsp;&nbsp;&nbsp; <input type= "checkbox" Name= "/> Agree with website Terms of service </td><td></td>
</tr>
</table>
</form>
</div>

<script type= "Text/javascript" >
Kissy.use ("Validation", function (s,validation) {
var regform = new Validation (' #reg_form ', {
Style: "Under"
});

Regform.add ("#username", {
Length:[6,30,true],//account length 6-30 characters
remote:[' Ajax.php?mod=member&ado=verify_username ']//ajax way to determine whether the account is occupied
});

Regform.add ("#pwd", {
Length:[6,30,true]//password length 6-30 characters
});

Regform.add ("#rpwd", {
equalto:[' #pwd ']//Confirm password = password
});

Regform.add ("#realname", {
chinese:[' real name can only be Chinese ']///Name must be in Chinese
});

Regform.add ("#email", {//Judging email format
Required:false,
email:[' Please fill in the correct email Oh '
});

S.event.on ("#reg_form", "Submit", function (EV) {//Click submit again JS mode to verify required fields
var isValid = Regform.isvalid ();
if (!isvalid) {
return false;
}
});
});

Kissy.use ("Node,calendar,calendar/assets/base.css", function (S,node,calendar) {//This is a calendar component
New S.calendar (' #birdate ', {//Birth date field
Popup:true,
triggertype:[' click '],
Closable:true
}). On (' Select ', function (e) {
Node.one (' #birdate '). Val (S.date.format (e.date, ' isodate '));
});
});
</script>
</body>

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.