#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    22
    Rep Power
    0

    form validation!!!


    Hello,

    I have a PHP form where in i call a form validation function onSubmit of the form.

    Now in the validation function i check whether all the fields have value or not. If no value exists i return false. But the form ignores the return false statement and processes the page. I cant seem to figure out why? How do i stop the form to execute the action statement ?

    Thanks & Regards
    Bosky
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    19
    In the <form> tag it should read:
    onsubmit="return yourvalidationfunction(yourarguments)"

    If the 'return' is missing, the form will always be submitted. Now, if you already have that, post the relevant code...

    Hope this helps,
    Jeroen
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    22
    Rep Power
    0

    return statement too does not work!


    Hi There,

    I'm attaching my file along with this reply. Please have a look and letme know where i'm going wrong?

    Thanks in Advance
    Bosky
    Attached Files
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    19
    Just remove the onclick handler(s) from your graphical image (submit) buttons. The ones like:
    Code:
    onClick="document.company.submit()"
    Hope this helps,
    Jeroen

    (It would have been easier to have had a look at the generated HTML code, by the way, but I managed to find it rather quickly..)
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    22
    Rep Power
    0
    Thanks a lot Jerome....your piece of advice seems to be working, though i had to change the type of submit image to "type=submit"
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    19
    though i had to change the type of submit image to "type=submit"
    Really? Works fine here with an <input type="image"> using Mozilla or IE.

IMN logo majestic logo threadwatch logo seochat tools logo