數據驗證
基本方法
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;
}
數據驗證