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 5 of 5
  1. #1
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts

    Two form actions?

    Is it allowable to have two actions on submitting the same form, and if so what is the correct syntax, please?

    Something like:-

    <FORM action="http://mydomain.co.uk/cgi-bin/script1.pl; http://anotherdomain.co.uk/cgi-bin/script2.pl" onsubmit="runascript">

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Philip M
    Is it allowable to have two actions on submitting the same form
    No. It is not.
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Thanks for the answer.

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,172
    Thanks
    19
    Thanked 65 Times in 64 Posts
    actually you can have a form that has multiple actions if for example you want your form to have differing actions based on buttons presses.

    The first way would be to combine your 2 scripts and have a different part fire depending on which button was pressed.

    The second way would be to use javascript to change the forms action onClick of the buttons eg.

    Code:
    <form action = "" name = "formname">
    <input type = "submit" name = "script1" Value = "Script1" onClick = "javascript:document.formname.action = 'script1.pl';document.formname.submit();">
    <input type = "submit" name = "script2" Value = "Script2" onClick = "javascript:document.formname.action = 'script2.pl';document.formname.submit();">
    </form>

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Thanks NancyJ. Very informative.

    I have now found your thread number 53576
    which answers my question.
    Last edited by Philip M; 05-18-2005 at 06:47 PM.


  •  

    Posting Permissions

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