国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

html - form 表單 用戶名提示和錯(cuò)誤提示分開顯示?
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-15 17:03:55
0
1
767

點(diǎn)擊輸入框,顯示用戶名提示,點(diǎn)擊立即注冊(cè)按鈕,在輸入框下顯示錯(cuò)誤提示

<form class="form-horizontal" name="checkForm" ng-init="isEmpty=false;">
    <p class="form-group">
        <label class="col-sm-3 control-label">用 戶 名</label>
        <p class="col-sm-8 account">
            <input type="text" class="form-control showHide" placeholder="您的賬戶名和登錄名"
                ng-model="account"
                name="account"
                required="required"
                ng-pattern="regularList.account"
                ng-blur="checkForm.account.$blured = false;"
                ng-focus="checkForm.account.$blured = true;"
                autocomplete="off"/>
            <span ng-class="{'right':(checkForm.account.$error.pattern),'error':checkForm.account.$valid}"></span>
        </p>
        <span ng-messages="isEmpty && checkForm.account.$blured && checkForm.account.$error" role="alert">
            <span class="error_text" ng-message="required" style="color: #ff0000">用戶名不能為空</span>
        </span>
        <span ng-messages="checkForm.account.$blured && checkForm.account.$error" role="alert">
            <span class="error_text" ng-message="pattern"style="color: #ff0000">用戶名為4-20位中文數(shù)字與英文字母組成!</span>
        </span>
    </p>
    <p class="tip-container" ng-if="checkForm.account.$blured==true">
        <p class="input-tip" ng-show="checkForm.account.$blured">
            <i></i>
            <span>!支持中文、字母、數(shù)字、“-”“_”的組合,4-20個(gè)字符</span>
        </p>
    </p>

具體效果如下

現(xiàn)在是輸入內(nèi)容不希望顯示錯(cuò)誤提示
我現(xiàn)在的問題是,輸入相應(yīng)的內(nèi)容,會(huì)有錯(cuò)誤的提示,效果見下

目的:輸入內(nèi)容不提示錯(cuò)誤,點(diǎn)擊立即注冊(cè),如果不符合相應(yīng)的規(guī)范,再提示錯(cuò)誤。
求指點(diǎn),謝謝

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證高級(jí)PHP講師

全部回復(fù)(1)
左手右手慢動(dòng)作

也是醉了。。。
<input type="text" class="form-control showHide" placeholder="您的賬戶名和登錄名"

            ng-model="account"
            ng-pattern="regularList.account"/>

<span ng-show="showAccountError" role="alert">

        <span class="error_text" style="color: #ff0000">用戶名為4-20位中文數(shù)字與英文字母組成!</span>

</span>
當(dāng)用戶提交的時(shí)候,在controller中用正則判斷$scope.account是否合法,不合法的話,就讓$scope.showAccountError=true.在頁面初始化的時(shí)候給這個(gè)變量賦false。

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板