亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

angularJS中form表單提交具體項目代碼如下,提交時候出現數據不全也能提交的情況。忘大神幫忙解答

angularJS中form表單提交具體項目代碼如下,提交時候出現數據不全也能提交的情況。忘大神幫忙解答

慕虎8944357 2016-11-30 15:43:45
????? <script type="text/ng-template " id="myModalContent.html ">?? ??? ??? ?<form name="merchantForm " class="bs-example form-horizontal form-validation " ng-submit="ok() ">?? ??? ??? ??? ?<div class="modal-body ">?? ??? ??? ??? ??? ?<div class="panel panel-default ">?? ??? ??? ??? ??? ??? ?<div class="panel-heading font-bold ">{{title}}</div>?? ??? ??? ??? ??? ??? ?<div class="panel-body ">?? ??? ??? ??? ??? ??? ??? ?<div class="form-group ">?? ??? ??? ??? ??? ??? ??? ??? ?<label class="col-lg-3 control-label ">商戶名稱</label>?? ??? ??? ??? ??? ??? ??? ??? ?<div class="col-lg-9 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<input type="text " class="form-control " placeholder="商戶名稱 " ng-model="merchant.name " required ng-maxlength="32 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<!--<span class="help-block m-b-none ">Example block-level help text here.</span>-->?? ??? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?<div class="form-group ">?? ??? ??? ??? ??? ??? ??? ??? ?<label class="col-lg-3 control-label ">商戶地址</label>?? ??? ??? ??? ??? ??? ??? ??? ?<div class="col-lg-9 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<input type="text " class="form-control " placeholder="商戶地址 " ng-model="merchant.address " required ng-maxlength="64 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<!--<span class="help-block m-b-none ">Example block-level help text here.</span>-->?? ??? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?<div class="form-group ">?? ??? ??? ??? ??? ??? ??? ??? ?<label class="col-lg-3 control-label ">聯系人</label>?? ??? ??? ??? ??? ??? ??? ??? ?<div class="col-lg-9 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<input type="text " class="form-control " placeholder="聯系人 " ng-model="user.realName " required ng-maxlength="16 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<!--<span class="help-block m-b-none ">Example block-level help text here.</span>-->?? ??? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?<div class="form-group ">?? ??? ??? ??? ??? ??? ??? ??? ?<label class="col-lg-3 control-label ">聯系電話</label>?? ??? ??? ??? ??? ??? ??? ??? ?<div class="col-lg-9 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<input type="phone" class="form-control " placeholder="聯系電話 " ng-model="user.phone " required? ng-pattern="/^1[3|4|5|7|8][0-9]\d{8}$/" ng-maxlength="11" popover="請輸入您的手機號碼。" popover-trigger="focus">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<!--<span class="help-block m-b-none ">Example block-level help text here.</span>-->?? ??? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?<div class="form-group ">?? ??? ??? ??? ??? ??? ??? ??? ?<label class="col-lg-3 control-label ">管理員賬號</label>?? ??? ??? ??? ??? ??? ??? ??? ?<div class="col-lg-9 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<input type="text " class="form-control " placeholder="管理員賬號 " ng-model="user.loginName " required ng-maxlength="16" ng-pattern="/^[a-zA-Z]\w{5,15}$/" popover="請輸入一個字母開頭,6-16字節的登錄賬號。" popover-trigger="focus">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<!--<span class="help-block m-b-none ">Example block-level help text here.</span>-->?? ??? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?<div class="form-group ">?? ??? ??? ??? ??? ??? ??? ??? ?<label class="col-lg-3 control-label ">管理員密碼</label>?? ??? ??? ??? ??? ??? ??? ??? ?<div class="col-lg-9 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<input type="password" class="form-control " placeholder="管理員密碼 " name="password " ng-model="user.password " required ng-maxlength="32" ng-pattern="/^[a-zA-Z]\w{5,15}$/"? popover="請輸入一個字母開頭,6-16字節的登錄密碼。">?? ??? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?<div class="form-group ">?? ??? ??? ??? ??? ??? ??? ??? ?<label class="col-lg-3 control-label ">確認密碼</label>?? ??? ??? ??? ??? ??? ??? ??? ?<div class="col-lg-9 ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<input type="password" class="form-control " placeholder="確認密碼 " name="confirmPassword " popover="請再次確認您的密碼。" popover-trigger="focus" ng-model="user.confirmPassword " required ng-pattern="/^[a-zA-Z]\w{5,15}$/" ng-maxlength="32 " ui-validate=" '$value==user.password' " ui-validate-watch=" 'user.password' ">?? ??? ??? ??? ??? ??? ??? ??? ??? ?<span ng-show='merchantForm.confirmPassword.$error.validator'>確認密碼不正確</span>?? ??? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ??? ?<div class="text-danger wrapper text-center " ng-show="authError ">?? ??? ??? ??? ??? ??? ??? ??? ?{{authError}}?? ??? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ??? ?</div>?? ??? ??? ??? ?</div>?? ??? ??? ??? ?<div class="modal-footer ">?? ??? ??? ??? ??? ?<button type="submit " class="btn btn-primary ">確認</button>?? ??? ??? ??? ??? ?<button type="button " class="btn btn-default " ng-click="cancel() ">取消</button>?? ??? ??? ??? ?</div>?? ??? ??? ?</form>?? ??? ?</script>?? ?</div>
查看完整描述

1 回答

?
__innocence

TA貢獻313條經驗 獲得超208個贊

這個問題很好解決,我是這樣解決的:

<button type="submit" class="btn btn-primary" ng-disabled="SignUpForm.$invalid">提交</button>

SignUpForm是我自己表單的id,你可以換一下

這個意思就是:如果存在不合法的驗證,按鈕就是不可點的狀態

查看完整回答
反對 回復 2016-12-03
  • 慕虎8944357
    慕虎8944357
    我本來是這么寫的,但是老大說禁選按鈕會影響用戶體驗,請問有沒有更好的辦法。
  • 1 回答
  • 0 關注
  • 2482 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號