How do I stop an HTML function from working with Javascript?

Asked

Viewed 58 times

0

I’d like it if the allowSubmit be false, he did not execute the action of form (action="logintest.php"). How can I do that?

function check_if_capcha_is_filled (e) {
    if(allowSubmit)
        return true;
    else{
        alert('Fill in the capcha!');
        //Código aqui
    }
}

<form method="post" onsubmit="check_if_capcha_is_filled()" action="logintest.php">

1 answer

2


function check_if_capcha_is_filled (e) {
    if(allowSubmit)
        return true;
    else{
        alert('Fill in the capcha!');
        return false;
    }
}
<form method="post" onsubmit="return check_if_capcha_is_filled()" action="logintest.php">

Just put Return to onsubmit and return false.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.