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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation Pause/Cancel Form Submission

    I have the following button:
    <input type=Submit name=SendButton value=Send>
    It generates me the queryString:
    "SendButton=Send"

    But I wanna do some checks before it gets to the ASP Code.
    I want to include something in an onclick event to pause the submission of the form to check if there are errors, if there are... cancel the submission and if there are no errors continue the submission as if I had just pressed the Send button and the form submitted and generated me the "SendButton=Send"

  • #2
    Regular Coder
    Join Date
    Nov 2004
    Location
    Edinburgh, SCO
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay you can do this in a number of ways. The 'normal' way is to add the following to the FORM tag: onSubmit="return validate();"

    Then create the function validate() to do your checking and then make sure you return true if no checks where found and return false if there were errors.

    You don't need to do it with the onClick function for the submit button as this won't stop the form being submitted if there are errors found.

    However why don't you use ASP to do the checking for you? Surely this will be easier and doesn't require JS to be enabled on the users computer.

    Hope this helps.

    Frank

  • #3
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    it helped thanks!!!


  •  

    Posting Permissions

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