View Full Version : Javascript newbie needs help with html form validation please

07-14-2011, 04:27 PM

I am trying to write a simple script for html form validation before going on to write a more complicated script for the full form which will eventually be on the web page. However, I cannot tell if the javascript is executing or not, as no alert messages come up. If I fill in the form with blanks (which is what the function checkform() checks for) then it should display an alert on submission and return false. Otherwise, returns true.

I need to get this licked before going on to the more complex coding, but I really can't see why this doesn't appear to work. I'd be most grateful if some kind soul out there could have a look at it for me.... Links below.

Thank you in anticipation!


07-14-2011, 05:53 PM
We need to see all the code. But for starters if statements are inclosed in parentheses and a compassion is done with == not =.
if document.assessmentform.phone=""

Should be:

if (document.assessmentform.phone == "" )

07-14-2011, 05:56 PM
thanks for that! I knew that, don't know how I missed that one - I've made the change and am still no clearer as to what is happening, if you'd like me to post up sections of code I'm happy do so..

07-14-2011, 06:24 PM
Your top link is broken. So yes code would be nice.

07-14-2011, 06:30 PM
Hi sunfighter. Thanks to your help, and looking at it again I am now getting somewhere, so no worries for now - I will post again when I need help for the next, more complicated bit!