这是 Simple form .
这是JS代码:
$(document).ready(function() {
$('#ledgerHolderjHolderFormEdit').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
JH_INIT: {
validators: {
notEmpty: {
message: "'First Name' is required."
},
regexp: {
regexp: /^07[a-zA-Z0-9.,:;!-@#\$%\^\&*\)\(+=_-`~><|].+$/,
message: "'Mobile Number' must only start with '07'."
},
stringLength: {
min: 5,
max: 30,
message: "'First Name' must be more than 2 and less than 255 characters long."
}
}
}
}
});
});
控制台中没有错误显示,也找不到错误。谁能帮帮我?
最佳答案
找到解决方案
form和js都没有效果。问题是,我在“编辑功能”中编写了 html 表单(使用 jQuery 附加 html 表单)。并在验证功能写入另一个功能后。这就是原因。
经过多次努力,我在那个“编辑功能”中写了验证。问题已解决。
关于javascript - Bootstrap 表单验证在没有控制台错误的情况下无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47673360/