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
    bam
    bam is offline
    New to the CF scene
    Join Date
    Apr 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How bypass form onsubmit when cancel

    I have an form onsumbit that validates all required fields before submitting the information to the Action and database insert. But when the user submts a cancel button I want to ignore the validation of required fields and just initiate the cancel process. I am new to this process an not sure how to implement. Any help would be greatly appreciated.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Assuming your cancel button is actually another submit button, the following should do the trick.

    Code:
    <input type="submit" value="Cancel" onclick="this.form.onsubmit=null; return true;" />
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Delaware, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you could initialize a variable then change the value depending on the button pressed... in your validate routine, check against the variable.


  •  

    Posting Permissions

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