I have form that redirects on submit to url based on value from input fields. But if e-mail is incorrect my form is still submits. How can I fix it? URL of this form is dokuchaeva.com/donate/ . I need to validate is e-mail. Modern browsers validate it buy default. I have alert if e-mail field is wrong, but form still submits. I need to submit form and redirect to predefined url based on inserted info.
<form>
<label>DONATION AMOUNT</label> <input name="price" id="price" class="button" value="100" required size="6" tabindex="1"> RUB<br><br>
<label>YOUR E-MAIL</label> <input type="email" name="user_email" id="user_email" required="" placeholder="email@example.com" class="button" autofocus="autofocus" tabindex="0">
<input type="submit" id="submit" value="SUBMIT" class="button" tabindex="3" onclick="location.href= 'http://secure.onpay.ru/pay/dokuchaeva?'+'pay_mode=fix&pay_for=donation&price='+$('#price').val()+'¤cy=RUR&user_email='+$('#user_email').val()+'&pay_for=donation&convert=no&ln=en&url_success=dokuchaeva.com/donate/success.html&url_fail=dokuchaeva.com/donate/fail.html';">
</form>
First of all.You need to specify what kind of validation that you want.
If you want only client based validation that will handle form data without submitting.
Check Jquery Validation plugin which is quite handy.
http://docs.jquery.com/Plugins/Validation
If you want both client based and backend based validation.Firstly you need to validate on client-side with JQuery validation then submit the form and use your validation logic in the backend.
E.g Check if the email already exists in the DB or if the username is already taken etc.