在提交表单时,如果验证触发为true,则大于form.submit()上的显示错误;
submitHandler: function(form) {
debug: true,
success1.show();
error1.hide();
form.submit();
}
form html like this
<form method="post" id="clientordeR_create12" onsubmit="enableItemtax();"
action="<?php echo base_url('Clientorder/save'); ?>">
all input eliments here
<input type="submit" name="submit" class="btn green"
value="Save & Print" formtarget="_blank" id="spSlip"/>
</form>
答案 0 :(得分:2)
您很可能在表单中使用 id="submit"
和/或 name="submit"
这样的按钮或输入,如下所示:
<form>
<input type="text" name="someName" />
<input type="email" name="someEmail" />
<!-- Other form elements -->
<button type="submit" name="submit" id="submit">Submit</button>
</form>
这会将form.submit()
更改为字段引用,而不是方法调用。您可以通过控制台日志记录form.submit()
进行验证,该日志记录很可能会返回<button type="submit" name="submit" id="submit">Submit</button>
元素。
要解决此问题,您需要删除 id="submit"
和/或 name="submit"
属性,或将其更改为类似以下内容:
<form>
<input type="text" name="someName" />
<input type="email" name="someEmail" />
<!-- Other form elements -->
<button type="submit" name="submitBtn" id="submitBtn">Submit</button>
</form>
答案 1 :(得分:0)
只需更改输入类型提交或按钮类型提交名称=提交到其他名称和ID名称也与名称相同
<input type="submit" name="submit" id= "save" class="btn green">
change to like this and error solved in my case
<input type="submit" name="save" id= "save" class="btn green">