Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Javascript newbie needs help with html form validation please

    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/onli...ment_test.html
    http://www.kellyresources.co.uk/checkform.js

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,083
    Thanks
    23
    Thanked 592 Times in 591 Posts
    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 == "" )

  • #3
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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..

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,083
    Thanks
    23
    Thanked 592 Times in 591 Posts
    Your top link is broken. So yes code would be nice.

  • #5
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •