Multiple Submit buttons

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J. B. Moreno

    Multiple Submit buttons

    Is it possible to detect inside an onsubmit event /which/ button was
    pushed? I searched google and saw lots of suggestions for alternatives,
    but nobody outright saying it was impossible. At this point I just want to
    know....I'll worry about compatibility and other issues, later...

    --
    J.B.Moreno
  • Martin Honnen

    #2
    Re: Multiple Submit buttons



    J. B. Moreno wrote:
    [color=blue]
    > Is it possible to detect inside an onsubmit event /which/ button was
    > pushed? I searched google and saw lots of suggestions for alternatives,
    > but nobody outright saying it was impossible.[/color]

    If you add onclick handlers to the submit buttons to store the actual
    submit button e.g.
    <form
    onsubmit="if (this.submitBut ton.name == 'submit1') ..."
    ...>

    <input type="submit" name="submit1"
    onclick="this.f orm.submitButto n = this;
    return true;">

    then your code knows which button was clicked but without that it is not
    possible.


    --

    Martin Honnen

    Comment

    • J. B. Moreno

      #3
      Re: Multiple Submit buttons

      Martin.Honnen@g mx.de wrote:[color=blue]
      > J. B. Moreno wrote:
      >[color=green]
      > > Is it possible to detect inside an onsubmit event /which/ button was
      > > pushed? I searched google and saw lots of suggestions for
      > > alternatives, but nobody outright saying it was impossible.[/color]
      >
      > If you add onclick handlers to the submit buttons to store the actual
      > submit button e.g.[/color]
      -snip-[color=blue]
      > then your code knows which button was clicked but without that it is not
      > possible.[/color]

      Thanks. Very clear. I wonder why not, seems like it'd be an obvious
      thing....

      Anyway, thanks again. Now I can stop trying to find out how to do it...

      --
      J.B.Moreno

      Comment

      Working...