[英]Bootstrap form validation not working without console error
這是簡單的形式 。
這是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."
}
}
}
}
});
});
控制台中沒有顯示錯誤,也找不到錯誤。 誰能幫我?
找到解決方案
形式和js沒有任何影響。 問題是,我在“編輯功能”中編寫了html表單(使用jQuery附加html表單)。 並且在驗證函數后寫入另一個函數。 這就是原因。
經過多方努力,我在“編輯功能”中編寫了驗證。 問題解決了。
確保你已正確包含JQuery
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.