nui-提交表单校验
var form = new nui.Form("#form");
form.validate();
if(form.isValid() == false) return;
可以参考
http://doc.primeton.com/pages/viewpage.action?pageId=1146999
数据验证
监听处理控件的"validation"事件,自定义验证规则和错误描述信息:
<input id= "username" name= "username" onvalidation= "onUserNameValidation" class = "nui-textbox" required= "true" /> function onUserNameValidation(e) { if (e.isValid) { if (isEmail(e.value) == false ){ e.errorText = "必须输入邮件地址" ; e.isValid = false ; } } } |
使用nui.Form组件对多个控件进行验证:
var form = new nui.Form( "#form1" ); form.validate();
|