<form id="ff" method="post">
<div>
<label for="name">
Name:</label>
<input class="easyui-validatebox" type="text" name="name" required="true" validtype="length[5,12]"></input>
</div>
<div>
<label for="email">
Email:</label>
<input class="easyui-validatebox" type="text" name="email" required="true" validtype="email" invalidMessage="邮箱格式错误"></input>
</div>
<div>
<label for="subject">
Subject:</label>
<input class="easyui-validatebox" type="text" name="subject" required="true" missingMessage="不能为空"></input>
</div>
<div>
<label for="message">
Message:</label>
<textarea name="message" style="height: 60px;"></textarea>
</div>
<div>
<input type="submit" value="Submit">
</div>
</form>
Validate Rule
The validate rule is defined by using required and validType property, here are the rules already implemented:
- email: Match email regex rule.
- url: Match URL regex rule.
- length[0,100]: Between x and x characters allowed.
- remote['http://.../action.do','paramName']: Send ajax request to do validate value, return 'true' when successfully.
Properties
| Name |
Type |
Description |
Default |
| required |
boolean |
Defines if the field should be inputed. |
false |
| validType |
string |
Defines the field valid type, such as email, url, etc. |
null |
| missingMessage |
string |
Tooltip text that appears when the text box is empty. |
This field is required. |
| invalidMessage |
string |
Tooltip text that appears when the content of text box is invalid. |
null |
http://www.jeasyui.com/documentation/validatebox.php