首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >bootstrapValidator不工作了吗?

bootstrapValidator不工作了吗?
EN

Stack Overflow用户
提问于 2016-09-10 19:05:07
回答 2查看 355关注 0票数 0

我想在我的表单中使用bootstrapValidator,但我发现它不起作用。

下面是html代码。

代码语言:javascript
复制
<link href="css/bootstrap.min.css" rel="stylesheet" />
 <link href="css/style.css" rel="stylesheet" />
 <link href="css/bootstrapValidator.css" rel="stylesheet" />

<div class="col-sm-6 col-lg-6">
                    <form id="form_login" method="post" action="#">
                    <h2>Log In</h2>
        <div class="form-group">
                                    <div class="input-group">
                                         <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                                         <input type="email" name="email" id="loginemail" class="form-control input-lg" placeholder="Email Address"   tabindex="1">
                                    </div>
                        </div>
                        <div class="form-group">
                                    <div class="input-group">
                                          <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                                        <input type="password" class="form-control input-lg" id="loginpassword" maxlength="12" placeholder="Password" tabindex="2">
                                    </div>

                        </div>



                        <div class="row">
                            <div class="col-xs-12 col-md-6"><input type="submit" value="Log In" class="btn btn-theme btn-block btn-lg" tabindex="3"></div>
                            <div class="col-xs-12 col-md-6">Don't have an account? <a href="signin.html" tabindex="3">Register</a></div>
                        </div>
                    </form>
                </div>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery-3.1.0.js"></script>
<script src="js/bootstrapValidator.js"></script>
<script src="js/validations.js"></script>

下面是jquery代码

代码语言:javascript
复制
 $(document).ready(function() {

$('#form_login').bootstrapValidator({
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        loginemail: {
            validators: {
                notEmpty: {
                    message: 'The first name is required and cannot be empty'
                }
            }
        },
        loginpassword: {
            validators: {
                notEmpty: {
                    message: 'The last name is required and cannot be empty'
                }
            }
        } /* <-- removed unneeded comma */
    } /* <-- added closing brace */
});
    });

从早上开始,我试着找出问题所在,但我还没能找到它。任何人都可以建议或帮助我解决这个问题

EN

回答 2

Stack Overflow用户

发布于 2020-07-04 01:14:25

验证元素的“name”属性必须与插件初始值设定项中的“”field“”名称相同,将根据“”name“”属性验证插件。“”在bootstrapValidator的验证器字段中有id名称。虽然它是相当旧的,但如果有些人有问题,我可能会帮助你。

票数 0
EN

Stack Overflow用户

发布于 2021-07-02 02:34:16

您需要有一个输入类型submit才能使bootstrapValidator工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39425387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档