Closed 3ncor3 closed 7 years ago
Well, it seems no answer to my question but I manage to do a "quick and dirty" fix.
Just use the beforeValidation
event to remove the <span class="help-block">
element everytime a new validation is initiate.
$('#form).on('beforeValidation', function() {
$("span.help-block").remove();
});
Its work only when the submit button is clicked (no error message repeat) but it's still repeat on form blur validation event.
One problem with your setup code is that you apply it every time the button is clicked. The setup function is only supposed to run once.
Can you explain a bit more @victorjonsson? perhaps with example :)
Remove the part where you attach a callback function to the button click event $('#someButton').click
It should only be:
$.validate({
form : '#frmDaftar',
modules:"security",
errorElementClass:"is-invalid",
borderColorOnError:"",
errorMessageClass:"invalid-feedback m-0 p-0",
onSuccess : function() {
//triggger ajax
return false;
}
});
Yeah, my mistake. The button click event is unnecessary.
But, how to fix the error message keep repeated? any tips @victorjonsson ?
Thanks
The problem is that you have applied multiple classes in errorMessageClass
. Only a single class name is supported.
One problem with your setup code is that you apply it every time the button is clicked. The setup function is only supposed to run once.
Yes. It was my issue. Thanks!!!
Hi,
When I click the submit button multiple times then the error message will duplicate. How to fix this issue?
update : using jQuery v3.2.1
Thank you