37 users online (1 members and 36 guests)  


  Results 1 to 2 of 2

Related

  1. Problem With form validation of Postal Code    Forum: Javascript Forum
    Replies: 3
  2. Replies: 4
  3. Help with Javascript form validation please!!    Forum: Javascript Forum
    Replies: 2
  4. Form validation - please help!    Forum: Javascript Forum
    Replies: 3
  1. #1
    chimp's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2006
    Posts
    1

    Form Validation Help Needed Please

    I am knew here so hi to everyone, I have been told by a friend that this site is particularly helpful so here goes.

    I have a form that i want to ensure is filled out correctly before the user is able to proceed. I am also advised that Javascript is the easiest way to do this, however i have no idea how to implememnt it.

    http://chimp.cc/start.htm

    If the user fails to fill out the terms and conditions box with a "Yes"when the user clicks submit, i want a message to pop up to tell them to complete it.

    and to return the user to that field for completion.

    I honestly have no idea how to do this, can someone please help me.

    I have attached the source code too.

    Cheers

    Andy
    Attached Files Attached Files

  2. #2
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: Form Validation Help Needed Please

    It looks like you already have something?

    anyway if you dont, all you need to do is use:

    document.getElementById('id_goes_here').value to get what the items value is...

    then do an if statment to see if it fitts your needs

    then in the <form> tag make an element called 'onsubmit="return yourfunction()"' then have that function do a "return true" if the form is acceptable, and "return false" if it is not. and if you want to add a little message use alert() function http://www.wikijs.com/index.php?title=Alert

    if you return false to a onsubmit it will not submit the page.

    -ALL



Tags for this Thread