in reply to <input type="button"> does not generate parameter=>value pair

Maybe because this.form.submit() doesn't return true and if it would it would be too late to submit button1's value.
  • Comment on Re: <input type="button"> does not generate parameter=>value pair

Replies are listed 'Best First'.
Re: Re: <input type="button"> does not generate parameter=>value pair
by dda (Friar) on Jul 15, 2003 at 09:38 UTC
    Well, I tried both onclick="this.form.submit();return true;" and onclick="return this.form.submit();" - nothing works... The only thing came to my mind - to create another hidden varuable and to assign a value to in in "onclick" handler.

    --dda

      You didn't get what I mean!
      You use a submit button. If you supply an onclick handler, this one has to return true in order for the button to submit anything.
      But your onclick handler already does the submit.

      Question: What do you want to achieve?

        I want to submit the form either by button1 or button2, and to get a value of clicked button. The reason I do not use two submit buttons - in real life my form has a text field as well, and when I press "Enter" in that text field, I want to submit a form with button2, not with button1. That is why I changed type=submit to type=button..

        Thank you for you help!

        --dda