One form two destinations without JavaScript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M2

    One form two destinations without JavaScript?

    Hi,
    a have a single form whose elements reside in a table. I want to present a
    "Submit" and "Cancel" button at the bottom each of which have a different
    destination. This is of course easy to do if you either a) use javascript on
    a button or b) go to the dark side and put a form within a table. I would
    like to avoid these two techniques if possible. Any ideas?

    Matt.


  • Jukka K. Korpela

    #2
    Re: One form two destinations without JavaScript?

    "M2" <m2@nowhere.com > wrote:
    [color=blue]
    > a have a single form whose elements reside in a table.[/color]

    Is it relevant? Why? Why don't you post a URL?
    [color=blue]
    > I want to
    > present a "Submit" and "Cancel" button[/color]

    Virtually all "Cancel" buttons are worse than useless. They hardly help
    the user, but often cause serious damage.
    [color=blue]
    > at the bottom each of which
    > have a different destination.[/color]

    I think we now all guess the context and "purpose" of those buttons.
    [color=blue]
    > This is of course easy to do if you
    > either a) use javascript on a button or b) go to the dark side and
    > put a form within a table.[/color]

    What's dark about b)? All the rest is dark, though.
    [color=blue]
    > I would like to avoid these two
    > techniques if possible. Any ideas?[/color]

    If you have something that actually submits some data to some
    processing, redesign the form. If not, remove the form. If problems
    remain, post the URL or, if you want quick help, check the FAQ.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

    Comment

    • luc wastiaux

      #3
      Re: One form two destinations without JavaScript?



      M2 wrote:[color=blue]
      > Hi,
      > a have a single form whose elements reside in a table. I want to present a
      > "Submit" and "Cancel" button at the bottom each of which have a different
      > destination. This is of course easy to do if you either a) use javascript on
      > a button or b) go to the dark side and put a form within a table. I would
      > like to avoid these two techniques if possible. Any ideas?[/color]

      Here's a possible solution:
      have two different "submit" buttons, with different names. On the CGI
      side, check for the existence of the variable <name> (you do this
      differently if you use GET or POST). Here's an example using PHP:

      <form name="myform" method="POST" action"http://url/post.php">
      <input type="text" name="informati on">
      <input type="submit" name="submit_ok " value="Submit">
      <input type="submit" name="submit_ca ncel" value="Cancel">
      </form>

      And here is post.php:

      <?

      if (isset($_POST["submit_ok"]))
      {
      // process SUBMIT
      }
      else if (isset($_POST["submit_can cel"]))
      {
      // process cancel
      }

      ?>

      I haven't tested this though but it should work.

      --
      luc wastiaux - email: dustpuppy@airpo st.net

      Comment

      • M2

        #4
        Re: One form two destinations without JavaScript?

        > Here's a possible solution:[color=blue]
        > have two different "submit" buttons, with different names. On the CGI
        > side, check for the existence of the variable <name> (you do this
        > differently if you use GET or POST). Here's an example using PHP:[/color]

        Thanks I hadn't thought of that, makes sense though.

        Matt.


        Comment

        Working...