Boot Strape添加隐藏按钮以形成,如何防止它?

时间:2017-08-02 05:35:13

标签: twitter-bootstrap twitter-bootstrap-3

我有使用bootstrape验证器进行验证的表单,但是当我将表单重定向到当前url而不是指定的action url时,这只是因为bootstrape验证器添加了隐藏按钮才能生成。关于如何制止这个的任何建议?

以下是我的表格

<div class="form_videos">
 <form id="webLinkForm" method="POST" name="webLinkForm" action="{{url('/')}}/adminarea/videos/savelink" data-toggle="validator" role="form" >
            <input type="hidden" id="itemID" name="itemID" value="{{$itemID}}">
                <input type="hidden" id="videoTypeID" name="videoTypeID" value="{{$videoTypeID}}">
                <input type="hidden" id="videoID" name="videoID" value="">
                <input type="hidden" id="method" name="method" value="add">
                <div class="form-group">
                        <label>Video Link</label>
                        <a href="#"><img src="{{ url('/') }}/components/images/help_icon.png" alt="Help" title="" /></a>
                        <input type="text" name="weblink" id="weblink" class="form-control">
                </div>
                <div class="form-group">
                        <label>Video Title</label>
                        <input type="text" name="caption" id="caption" class="form-control">
                </div>
                <div class="form-group">
                        <label>Video Description</label>
                        <textarea class="form-control textarea" id="description" name="description" maxlength="150"></textarea>
                </div>
                <div class="form-group">
                        <input type="submit" value="Save Link" form="webLinkForm">
                </div>
        </form>
        <br/>
</div>

以下是我在document.ready上的js代码    $(&#39;#webLinkForm&#39)。bootstrapValidator({          框架:&#39; bootstrap&#39;,          icon:{              有效:&#39; glyphicon glyphicon-ok&#39;,              无效:&#39; glyphicon glyphicon-remove&#39;,              验证:&#39; glyphicon glyphicon-refresh&#39;          },         字段:{                     网页链接:                     {                         消息:&#39;请输入视频链接。&#39;,                         验证:                             {                                 notEmpty:{message:&#39;请输入视频链接&#39;},                             }                     },                     字幕:{                         消息:&#39;请输入标题。&#39;,                         验证:                             {                                 notEmpty:{message:&#39;请输入标题。&#39;},                             }                         }         }     });

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
<div class="form_videos">
 <form id="webLinkForm" method="POST" name="webLinkForm" action="{{url('/')}}/adminarea/videos/savelink" data-toggle="validator" role="form" >
            <input hidden="hidden" id="itemID" name="itemID" value="{{$itemID}}">
                <input hidden="hidden" id="videoTypeID" name="videoTypeID" value="{{$videoTypeID}}">
                <input hidden="hidden" id="videoID" name="videoID" value="">
                <input hidden="hidden" id="method" name="method" value="add">
                <div class="form-group">
                        <label>Video Link</label>
                        <a href="#"><img src="{{ url('/') }}/components/images/help_icon.png" alt="Help" title="" /></a>
                        <input type="text" name="weblink" id="weblink" class="form-control">
                </div>
                <div class="form-group">
                        <label>Video Title</label>
                        <input type="text" name="caption" id="caption" class="form-control">
                </div>
                <div class="form-group">
                        <label>Video Description</label>
                        <textarea class="form-control textarea" id="description" name="description" maxlength="150"></textarea>
                </div>
                <div class="form-group">
                        <input type="submit" value="Save Link" form="webLinkForm">
                </div>
        </form>
        <br/>
</div>
&#13;
&#13;
&#13;