1. Page effect. The verification information is displayed automatically...
2. Page code
Copy codeThe Code is as follows:
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> form verification page </title>
<Link href = "../Scripts/themes/default/easyui.css" rel = "stylesheet" type = "text/css"/>
<Script src = "../Scripts/jquery-1.4.1.min.js" type = "text/javascript"> </script>
<Script src = "../Scripts/jquery. easyui. min. js" type = "text/javascript"> </script>
<Script src = "../Scripts/validator. js" type = "text/javascript"> </script>
<Script src = "../Scripts/locale/easyui-lang-zh_CN.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
$ (Function (){
// Load verification information
$ ('# Uiform input'). each (function (){
If ($ (this). attr ('required') | $ (this). attr ('validtype '))
$ (This). validatebox ();
})
$ ('# Ajax_test2'). click (function (){
$. Ajax ({
Url: "../Handler1.ashx? Menthod = Login ",
Type: 'post ',
Data: {name: "123456 "},
Timeout: 30000,
BeforeSend: function (XMLHttpRequest ){
// Alert ('remote call starts ...');
$ ("# Loading" pai.html (" ");
},
Success: function (data, textStatus ){
Alert ('start callback, status text value: '+ textStatus +' return data: '+ data );
$ ("# Loading"). empty ();
},
Complete: function (XMLHttpRequest, textStatus ){
Alert ('remote call succeeded, status text value: '+ textStatus );
$ ("# Loading"). empty ();
},
Error: function (XMLHttpRequest, textStatus, errorThrown ){
Alert ('error... status text value: '+ textStatus + "exception information:" + errorThrown );
$ ("# Loading"). empty ();
}
});
});
$ ("# Btn"). click (function (){
Var flag = true;
Flag = $ ("# uiform"). form ("validate ");
// $ ('# Uiform input'). each (function (){
// If ($ (this). attr ('required') | $ (this). attr ('validtype ')){
// If (! $ (This). validatebox ('isvalid ')){
// Flag = false;
// Return;
//}
//}
//})
If (flag ){
$ ("# Uiform"). form ("destroy ");
Alert ('verification passed! ');
}
});
});
</Script>
<Style type = "text/css">
# Name
{
Width: 191px;
}
. Style4
{
Width: 100px;
}
. Style5
{
Width: 98px;
}
# TxtPassword
{
Width: 150px;
}
. Style7
{
Width: 371px;
}
. Style8
{
Width: 420px;
}
# Btn
{
Width: 86px;
}
. Style9
{
Width: 100px;
Height: 26px;
}
. Style10
{
Width: 371px;
Height: 26px;
}
. Style11
{
Width: 98px;
Height: 26px;
}
. Style12
{
Width: 420px;
Height: 26px;
}
. Style13
{
Width: 100px;
Height: 25px;
}
. Style14
{
Width: 371px;
Height: 25px;
}
. Style15
{
Width: 98px;
Height: 25px;
}
. Style16
{
Width: 420px;
Height: 25px;
}
</Style>
</Head>
<Body>
<Form id = "uiform" title = "form verification page" class = "easyui-window">
<Br/>
<Table>
<Tr>
<Td class = "style9"> Logon Name: </td>
<Td class = "style10"> <input required = "true" id = "txtUsername" type = "text" class = "txt03" validType = "account [4, 20]"/> </td>
<Td class = "style11"> real name: </td> <td class = "style12"> <input id = "txtTruename" validType = "CHS" required = "true" type = "text" class = "txt03 "/> </td>
</Tr>
<Tr>
<Td class = "style13"> logon password: </td>
<Td class = "style14"> <input validType = "password" required = "true" id = "txtPassword" name = "password" type = "password" class = "txt03" /> </td>
<Td class = "style15"> Email: </td>
<Td class = "style16"> <input id = "txtEmail" name = "email" validType = "email" type = "text" class = "txt03"/> </td>
</Tr>
<Tr>
<Td class = "style4"> ID card number: </td> <td class = "style7"> <input validType = "idcard" id = "txtIdcard" name = "idcard" type = "text" class = "txt03 "/> </td>
<Td class = "style5"> QQ: </td>
<Td class = "style8"> <input validType = "QQ" id = "txtQq" name = "qq" type = "text" class = "txt03"/> </td>
</Tr>
<Tr>
<Td class = "style4"> mobile phone: </td> <td class = "style7"> <input validType = "mobile" id = "txtMobile" name = "mobile" type = "text" class = "txt03 "/> </td>
<Td class = "style5"> Tel: </td> <td class = "style8"> <input id = "txtTel" validType = "phone" name = "tel" type = "text" class = "txt03 "/> </td>
</Tr>
<Tr>
<Td class = "style4"> ZIP code: </td> <td class = "style7"> <input validType = "ZIP"
Id = "txtZIP" name = "txtZIP" type = "text" class = "txt03"/> </td>
<Td class = "style5"> Age: </td> <td class = "style8">
<Input validType = "number"
Id = "txtZIP0" name = "txtZIP0" type = "text" class = "txt03"/> </td>
</Tr>
<Tr>
<Td class = "style4"> remarks: </td> <td colspan = "3"> </textarea>
<Input type = "text" class = "easyui-validatebox" required = "true" validType = "minLength [50]"
Style = "width: 41%; height: 74px;" class = "txt03" id = "txtRemark"> </td>
</Tr>
<Tr>
<Td class = "style4"> </td> <td colspan = "3"> <input id = "Checkbox1" type = "checkbox"/> <label> super administrator </label> <input id = "Checkbox2" type = "checkbox"/> <label> disable </label> </td>
</Tr>
<Tr>
<Td class = "style4"> text </td> <td colspan = "3">
<Input id = "name" type = "text" class = "easyui-validatebox"
MissingMessage = "prompt text when the text box is empty. "InvalidMessage =" prompt text displayed when the text box content is invalid "required =" true "validType =" minLength [5] "/> </td>
</Tr>
<Tr>
<Td class = "style4"> text box comparison: </td> <td colspan = "3">
<Input type = "password" id = "txtpasswd" class = "easyui-validatebox" required = "true" validType = "password"/> 2 <input type = "password" id = "txtpasswd2" class = "easyui-validatebox" required = "true" validType = "verify to ['# txtpasswd']"/> </td>
</Tr>
</Table>
<Hr/>
<Center> <input id = "btn" type = "button" value = "submit"/>
<Input id = "ajax_test2" type = "button" value = "ajax_test2"/> </center>
<Div id = "loading"> </div>
</Form>
</Body>
</Html>