live-form-validation icon indicating copy to clipboard operation
live-form-validation copied to clipboard

Check if form is valid

Open Isigar opened this issue 5 years ago • 2 comments

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();
                        }
                    }
                });

Isigar avatar Mar 05 '19 08:03 Isigar

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();
                                }
                            }
                        }
                    }
                });```

Isigar avatar Mar 05 '19 08:03 Isigar

?

Isigar avatar Mar 13 '19 10:03 Isigar