jQuery Validation Plugin停止表单提交,提交按钮无法正常工作
以下使用jQuery验证插件的脚本- http://docs.jquery.com/Plugins/Validation -阻止发送在此处找到的表单:
The following script using jQuery validation plugin - http://docs.jquery.com/Plugins/Validation - is preventing the form from sending that is found here:
http://www.bestcastleintown.co.uk/book2.php
请填写表格,查看确认消息消失,然后尝试按发送,这似乎没有发送,我不明白为什么.
Please fill in the form and watch the validation messages disappear then try to press send, this seems not to send and I don't understand why.
删除此脚本后,联系表单将正常运行并允许发送.因此,我认为这是造成问题的原因.任何帮助或建议,将不胜感激.
When this script is removed the contact form will function correctly and allow sending. Therefore I think it is causing the problem. Any help or suggestions would be much appreciated.
<script type="text/javascript">
jQuery.validator.setDefaults({
debug: true,
success: "valid"
});;
</script>
<script>
$(document).ready(function() {
$("#aform").validate({
rules: {
postcode: {required: true,minlength: 6},
phone: {required: true,number: true}
}
});
});
</script>
您正在调试模式下运行验证器. 相关文档说(强调我):
You are running the validator in debug mode. The relevant documentation says (emphasis mine):
调试布尔默认值:
false
启用调试模式.如果true
,未提交表单,并且控制台上显示某些错误
(需要Firebug或Firebug lite).尝试在表单刚刚启用时启用
提交,而不是停止提交.
Enables debug mode. If true
, the form is not submitted and certain errors are displayed on the console
(requires Firebug or Firebug lite). Try to enable when a form is just
submitted instead of validation stopping the submit.
删除debug: true
选项将解决您的问题.
Removing the debug: true
option will fix your problem.