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
    Jan 2003
    Location
    West Virginia
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple onSubmit's?

    Is it possible to run two onSubmit's in the same form action?

    [1] onSubmit="return function1(this.formname.value);"

    [2] onSubmit="return function2();"

    If so, would it be like this:

    onSubmit="return function1(this.formname.value); return function2();"

    or like this?:

    onSubmit="return function1(this.formname.value); function2();"

    or something else entirely?
    Thanks for any guidance!
    Reno CF

  • #2
    New Coder
    Join Date
    Apr 2007
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you want both functions to have to return true for the submit then use:
    Code:
    onsubmit="return (function1(this.formname.value) && function2());"
    If you just want to call multiple functions do this and make sure that you have the return on the LAST function call (or after if you always want it to fail/succeed)
    Code:
    onsubmit="function2();return function1(this.formname.value);"

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Location
    West Virginia
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you argothian -- I'll try running the 2 script on a test form in the next day -- appreciate your help...
    Reno CF


  •  

    Posting Permissions

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