使用Bootstrap 3 Validator验证Selectize.js字段

时间:2018-02-01 16:21:13

标签: twitter-bootstrap validation selectize.js bootstrapvalidator

我目前正在处理我已实施Selectize.jsBootstrap 3 Validator plugin的表单。现在我在提交表单时验证选择性输入字段时遇到了问题。

当我在没有为必填字段选择任何选项的情况下提交表单时,验证将起作用并表示必须填写该字段。但是当我在验证后为所有必填字段选择一个选项并再次提交表单时,它总是会说选择字段未经验证/为空。

// a required selectize field    
<div class="form-group has-error has-danger" data-field-id="42">

    <label class="control-label col-sm-2" for="field-42-selectized">
        Some field * </label>

    <div class="col-sm-10">
        <select class="field-input selectize selectized" data-field="42" name="field[42]" id="field-42" tabindex="-1" style="display: none;">
            <option value="" selected="selected"></option>
        </select>
        <div class="selectize-control field-input selectize single plugin-remove_button">
            <div class="selectize-input items required invalid not-full has-options">
                <input type="text" autocomplete="off" tabindex="" id="field-42-selectized" placeholder="-" required="" style="width: 8.51563px; opacity: 1; position: relative; left: 0px;">
            </div>
            <div class="selectize-dropdown single field-input selectize plugin-remove_button" style="display: none; width: 726.656px; top: 38px; left: 0px; visibility: visible;">
                <div class="selectize-dropdown-content">
                    <div class="option" data-selectable="" data-value="1">
                        data1
                    </div>
                    <div class="option" data-selectable="" data-value="2">
                        dat2
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

我已经完成了一些调试,并找到了出错的地方,即:

<input type="text" autocomplete="off" tabindex="" id="field-42-selectized" placeholder="-" required="" style="width: 8.51563px; opacity: 1; position: relative; left: 0px;">

0 个答案:

没有答案