TD - 数据验证

基本方法

this.assetCounts.focus();//聚焦

this.btnSave.cancel();//按钮取消

this.assetPerson.isValid()//是否有效,true:有效

 

验证数字类型 - bootstrap.form.NumberSpinner

if (isNaN(this.assetCounts.attr("value")) || !this.assetCounts.isValid()) {

alert(this.nls.MSG_ASSET_COUNT_IS_ERROR);

this.assetCounts.focus();

this.btnSave.cancel();

return;

}

 

电话号码验证 - html

regExp="^[1][3,4,5,7,8][0-9]{9}$" maxlength="11" minlength="11"

 

不能输入特殊字符(标点符号....)

<input dojoType="bootstrap.form.ValidationTextBox" regExp="${nls.REGEXP_EX.COMMON_EX}" invalidMessage="${nls.ENTER_FAIL}" maxLength=50 dojoAttachPoint="roadManageName">

 

只能输入正整数

<input type="text" dojoType="bootstrap.form.ValidationTextBox"   maxlength="33" value="" dojoAttachPoint="edtStatistical3" regExp="${nls.NUM_HOUR}" invalidMessage="${nls.PLEASE_ENTER_NUMBERHOUR}">

 

输入一位小数

<input type="text" dojoType="bootstrap.form.ValidationTextBox"  regExp="${nls.ALL_NUM}" invalidMessage="${nls.PLEASE_ENTER_ALLNUMBER}"  maxlength="33" value="" dojoAttachPoint="edtOwnRate">

        

输入违法后处理模板

if (!this.edtTravelTime.isValid()){

alert(this.nls.INPUT_WRONG);

this.edtTravelTime.focus();

this.btnAdd.cancel();

return;

}

posted @ 2018-08-28 17:10  萧韶九成  阅读(294)  评论(0编辑  收藏  举报