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
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts

    submit form ..multiple actions

    hi all,

    I have been using document.myform.submit(); onClick to submit a form however now I need the submit 1 form to 3 different places... I have three click buttons and I need the form action to be different depending on which button has been clicked.. does any one have any links or info on this?

    many thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,992
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Yopu can set the form action dynamically.

    function submit1() {
    document.myform.action = destination1;
    myform.submit();
    return true;
    }
    function submit2() {
    document.myform.action = destination2;
    myform.submit();
    return true;
    }
    function submit3() {
    document.myform.action = destination3;
    myform.submit();
    return true;
    }


    The three functions being called onclick from the three buttons respectively. onclick = "return submit1()" etc.

    Naturally Javascript must be enabled for this to work.
    Last edited by Philip M; 06-20-2008 at 11:45 AM.

  • Users who have thanked Philip M for this post:

    sir pannels (06-20-2008)

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Philip, thanks. very useful


  •  

    Posting Permissions

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