dojo版本1.8.5 对凭证号和预付款金额验证,符合要求,开放submit按钮,不符合要求,禁用之 废话不多说,直接线上代码。 scriptrequire(["dijit/form/ValidationTextBox", "dojox/validate/web","dijit/form/F
dojo版本1.8.5
对凭证号和预付款金额验证,符合要求,开放submit按钮,不符合要求,禁用之
废话不多说,直接线上代码。
<script> require(["dijit/form/ValidationTextBox", "dojox/validate/web","dijit/form/Form"])//表单验证 function handleOnValidStateChange(formIsValid) { dijit.byId('btnHidden1').attr('disabled', !formIsValid); //表单有错误信息禁用submit } </script>
<form data-dojo-type="dijit.form.Form" id="myForm" onValidStateChange="handleOnValidStateChange"> <table class="jkzz_rttable" cellspacing="0" cellpadding="0" style="border:none;"> <tr class="jkzz_tb_tr"> <td > <label >用户</label> <span id="userHidden"></span> </td> </tr> <tr class="jkzz_tb_tr"> <td> <label> 凭证号 </label> <input id="credenceCode" name="credenceCode" type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-props="validator:dojox.validate.isInRange, constraints:{ min:0, max:999999,places:0}, invalidMessage:'This is not within the range of 0 to 999999!'" > </td> </tr> <tr class="jkzz_tb_tr"> <td> <label> 预付款金额 </label> <input id="creditBalance" type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-props="validator:dojox.validate.isInRange, constraints:{ min:0, max:999999 }, invalidMessage:'This is not within the range of 0 to 999999!'" > </td> </tr> <tr> <td style="text-align:right;border:none;padding:20px 36px 0 0;"> <button type="button" id="btnHidden1"data-dojo-type="dijit/form/Button" data-dojo-props="" onclick="func_add()">确定</button> </td> </tr> </table> </form>
输入正确以后