- /**
- * @author 孙宇
- *
- * @requires jQuery,EasyUI
- *
- * 扩展validatebox,添加验证两次密码功能
- */
- $.extend($.fn.validatebox.defaults.rules, {
- eqPassword : {
- validator : function(value, param) {
- return value == $(param[0]).val();
- },
- message : '密码不一致!'
- }
- });
先扩展validatebox
使用的时候,
- <form id="modifyPwdForm" method="post">
- <input name="ids" type="hidden" />
- <table class="tableForm">
- <tr>
- <th>新密码</th>
- <td><input name="cpwd" type="password" class="easyui-validatebox" required="true" missingMessage="请填写新密码" /></td>
- </tr>
- <tr>
- <th>重复</th>
- <td><input name="recpwd" type="password" class="easyui-validatebox" required="true" missingMessage="请再次填写新密码" validType="eqPassword['#modifyPwdForm input[name=cpwd]']" /></td>
- </tr>
- </table>
- </form>