I can’t see a clear mistake in this code. Instead of validating my fields, it just tries to send my form and I don’t know why.
This is my jsFiddle: http://jsfiddle.net/PAALA/
Other question, how to validate if select box was picked?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Firstly, because of how JSFiddle works, defining a function with
function foo() {...}is unreliable. Instead, usefoo = function() {...}syntax.Next, you have an error in your script when you try to access
document.forms["bug_form"]["Project"].value– there is no text input with that name.Finally, to prevent accidental submission, do this:
This will ensure that
falseis returned, even if your code errs.