H
H
historyfootball02018-08-09 17:20:13
AJAX
historyfootball0, 2018-08-09 17:20:13

How can I stop a form from being submitted until it's validated?

There is a registration form, with it Ajax check for employment of the login from the database.
Ajax validation works fine, but the form is submitted anyway.
How to disable form submission if username is busy?
_______________________________________________________________
I'll send you the code if needed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rikcon, 2018-08-09
@Rikcon

document.querySelector("#myForm").addEventListener("submit", function(e){
    if(!isValid){
        e.preventDefault();    //форма не отправится 
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question