Note that there are some explanatory texts on larger screens.

plurals
  1. POForm not redirecting after verified by javascript
    text
    copied!<p>I use a code to verify my registration form: <a href="http://rickharrison.github.com/validate.js/" rel="nofollow">http://rickharrison.github.com/validate.js/</a> That's my customed code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt;&lt;head&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;link href="./js/main.css" rel="stylesheet" type="text/css"&gt; &lt;script type="text/javascript" async="" src="./js/ga.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="./js/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="./js/validate.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="createAccount" action="validate.php" method="POST"&gt; &lt;label for="fname"&gt;First name:&lt;/label&gt; &lt;input name="fname" id="fname"&gt; &lt;label for="lname"&gt;Last name:&lt;/label&gt; &lt;input name="lname" id="lname"&gt; &lt;br/&gt; &lt;label for="email"&gt;Email:&lt;/label&gt; &lt;input name="email" id="email"&gt; &lt;br/&gt; &lt;label for="password"&gt;Password:&lt;/label&gt; &lt;input name="password" id="password" type="password"&gt; &lt;br/&gt; &lt;label for="vPassword"&gt;Re-type password:&lt;/label&gt; &lt;input name="vPassword" id="vPassword" type="password"&gt; &lt;br/&gt; &lt;button class="button gray" type="submit" name="submit"&gt;Submit&lt;/button&gt; &lt;/form&gt; &lt;div class="success_box"&gt;Si jvois ca ben tbnk&lt;/div&gt; &lt;div class="error_box"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; new FormValidator('createAccount', [{ name: 'fname', display: 'Please enter your first name.', rules: 'required' }, { name: 'lname', display: 'Please enter your name.', rules: 'required' }, { name: 'email', display: 'Please enter a valid email address.', rules: 'valid_email' }, { name: 'password', display: 'Please enter a password of at least 8 characters.', rules: 'required|min_length[8]' }, { name: 'vPassword', display: 'The passwords do not match.', rules: 'required|matches[password]' }, ], function(errors, event) { var SELECTOR_ERRORS = $('.error_box'), SELECTOR_SUCCESS = $('.success_box'); if (errors.length &gt; 0) { SELECTOR_ERRORS.empty(); for (var i = 0, errorLength = errors.length; i &lt; errorLength; i++) { SELECTOR_ERRORS.append(errors[i].message + '&lt;br /&gt;'); } SELECTOR_SUCCESS.css({ display: 'none' }); SELECTOR_ERRORS.fadeIn(200); } else { SELECTOR_ERRORS.css({ display: 'none' }); SELECTOR_SUCCESS.fadeIn(200); } if (event &amp;&amp; event.preventDefault) { event.preventDefault(); } else if (event) { event.returnValue = false; } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I tried changing the "success_box" to a function to redirect to my validate.php page, but nothing worked. I tried deleting everything to the success_box and make a function to redirect if the number of errors is 0</p> <pre><code>if (errors === 0){ window.location = "http://www.google.com/";} </code></pre> <p>But that didn't work either. I'm out of answers... </p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload