prevent the user from submitting
<p>I want to prevent the user from submitting data in a form, but when I test it with JavaScript it's not returning true.</p>

<p>this is the submit button :</p>

<pre><code>    input type="submit" value="S'inscrire" name="inscrire" onsubmit="return Verifier(this.form);"&gt;
</code></pre>

<p>and this is the code for the JS test function :</p>

<pre><code> function Verifier()
        {
            var mdp1 = document.form.mdp.value,
                        mdp2 = document.form.confirmer.value,
                        email = document.form.email.value,
                        pseudo = document.form.pseudo.value;

            var testMdpIdentique = (function() {

                    if(mdp1 == mdp2) return true;
                    else return false;
                 })();


            if(!testMdpIdentique || mdp1 == "" || mdp2 == "" || email == "" || pseudo== "" )
            {
                alert ('Il faut remplir tous les champs');
                return false;
            }
            return true;

        }
</code></pre>

<p>the problem is that it's submitting information even if the test is not valid, I tried to try an alert message in the Valider function but it didn't worked.</p>
