小编Ark*_*kni的帖子

为某些字段禁用Bootstrap Validator

我是Bootstrap Validator和Jquery的新手,正在尝试完成某些工作。

我有一个表格,例如字段

<div class="form-group" id="price_container">
    <label for="price">Asking Price</label><input class="form-control" style="width: 50%;" type="text" id="price" name="price" >
</div>

<div class="form-group">
    <label for="title">Title</label>
    <input class= "form-control" type="text" name="title">
</div>
Run Code Online (Sandbox Code Playgroud)

我可以通过以下方式验证它:

 $('#multiform')
    .find('[name="list_type"]')
        .change(function(e) {
           $('#multiform').bootstrapValidator('revalidateField', 'price');
        })
        .end()
    .bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
            required: 'fa fa-asterisk',
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            price: {
                validators: {
                   notEmpty: {
                      message: 'The price is required and cannot be empty'
                   },
                   integer: {
                      message: 'You …
Run Code Online (Sandbox Code Playgroud)

javascript validation jquery twitter-bootstrap jqbootstrapvalidation

5
推荐指数
1
解决办法
2万
查看次数