live-form-validation
live-form-validation copied to clipboard
Check if form is valid
Hello, thanks for lib otherwise I have a little problem to solve. I want to show loading after valid submit action how can I do that is there option to check if a form is validly filled up? I want to something like this but now its always show loading even if form is not valid and live validation add errors to form inputs.
Thanks for response.
$('button[type="submit"]').on('click',function (e) {
if($(this).data('loading')){
if($(this).data('loading') == 'LOADING_FULL'){
$("#full_loader").show();
}
}
});
Okey i try to use this variant which maybe will work but i have another problem. Live form dont use id of form but in console appears this: LiveForm.forms["[object HTMLInputElement]"]
My editted code:
$('button[type="submit"]').on('click',function (e) {
if($(this).data('loading')){
if($(this).data('loading') == 'LOADING_FULL'){
const id = $(this).find('form').attr("id");
if(LiveForm.forms[id] !== undefined){
if(LiveForm.forms[id].hasError === false){
$("#full_loader").show();
}
}
}
}
});```
?