即使存在validation错误,Bootstrap Validator也会提交表单

我有以下图片,您可以清楚地看到我提交表单后需要该字段。 在此处输入图像描述

但是,在提交表单后,它将继续执行JS中的按钮单击事件, 而不是停止表单提交。

我在BootStrap Validator中缺少什么,如果有validation错误,我可以阻止提交表单?

这是我的HTML5 MasterPage相关部分

  

这是我的JS被初始化,但运行时,我得到了我的评论中陈述的错误:

  $('#form1').bootstrapValidator({ live: 'enabled', feedbackIcons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { txtSPStatusComments: { selector: '#txtSPStatusComments', validators: { notEmpty: { message: 'The title is required and cannot be empty' } } } } }); 

这是我的HTML5

   

编辑 – 使用BootstrapValidator

母版

                           <%----%>               

HTML

 

JS

请注意,此函数内的代码将在onDocumentReady事件上执行。 我看到它在页面加载完成后执行。

 $('#form1').bootstrapValidator({ submitButtons: 'button[type="submit"]', fields: { txtSPStatusComments: { validators: { notEmpty: { message: 'Status Comments required!' } } } } });