-4

我正在使用一个引导模板,它使用“jqBootstrapValidation.js”(http://reactiveraven.github.io/jqBootstrapValidation)来验证它的形式。我编辑模板并向其添加表单,但我的提交按钮不起作用!当我评论包含“jqBootstrapValidation.js”的脚本时,我的提交按钮开始工作!我不想编辑 Javascript 文件。有没有办法只为我的表单禁用它?

这是我的表格:

<form name="register" id="regForm" name="input" action="pay.php" method="post">
        <div class="row control-group">
            <div class="form-group col-xs-12 floating-label-form-group controls">
                     <label> email</label>
                     <input type="email" class="form-control" 
                         id="email" required>
                     <p class="help-block text-danger"></p>
             </div>
        </div>

        <div class="row control-group">
              <div class="form-group col-xs-12 floating-label-form-group controls">
                     <label>Telephone</label>
                     <input type="tel" class="form-control"  id="phone" required>
                     <p class="help-block text-danger"></p>
              </div>
        </div>

        <div id="success"></div>

        <div class="row" align="left">
               <div class="form-group col-xs-12">               
                    <button type="submit" class="btn btn-success btn-lg">
                      register
                    </button>
               </div>
         </div>
 </form>
4

4 回答 4

1

您可以覆盖该功能

假设它是一个全局函数,例如

function handleForm () {
  //existing code
}

覆盖:

var originalFunction = window.handleForm; //store for future use
window.handleForm = function() {
  //psuedo code
  if(form is the one with this id/class/whatever call) newFunction();
  else originalFunction();
}
于 2014-08-06T10:08:06.910 回答
1

如果特殊形式在一个页面中,您可以删除那个大脚本链接。或者使用jquery动态加载js文件。

if(!$("#myformid")){
$.getScript("ajax/test.js");
}
于 2014-08-06T10:02:40.837 回答
0

您可以拿起表单并取消绑定其上的所有事件。推荐使用jQuery来解决它。

于 2014-08-06T10:07:21.473 回答
0

如果您至少提供一些脚本会有所帮助。

我会更改表单(或包含表单的元素)的类名或 id 或输入元素的类名。它取决于脚本所作用的 DOM 挂钩。

于 2014-08-06T10:03:15.323 回答