...

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



Treeze
07-14-2011, 05:27 PM
Hi

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!

http://www.kellyresources.co.uk/online_assesment_test.html
http://www.kellyresources.co.uk/checkform.js

sunfighter
07-14-2011, 06: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 =.
SO:
if document.assessmentform.phone=""

Should be:

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

Treeze
07-14-2011, 06: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..

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

Treeze
07-14-2011, 07: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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum