The name/value pair is included in the query string if you submit the form by pressing enter if you have tabbed to the submit button, which would have to be the case in this application (that, or clicking on the button). Actually, Mozilla always sends the submit button name/value pair - it's IE that doesn't unless the button is clicked or highlighted.
As for a workaround, you have to choose among hacks. There's the multiple forms/hidden fields hack as already suggested, or you can do a javascript onClick for each submit button that changes a hidden field. The problem with the former is if there are other, shared form elements you have to do further hacks (probably javascript) to distribute the information to each form. The latter hack is better, but relies on javascript, which I like to avoid.
What I like to do is name the submit buttons differently, and use the names as values. For example, if you have
<input type='submit' name='add1' value='Add'>
<input type='submit' name='add2' value='Add'>
and the user clicks on the first "Add" button, you'll get a add1/Add key value pair - you use the name/key as the submit button value and you're set (just make sure your naming scheme won't clobber any of your other form element names). | [reply] [d/l] |
-------------------------------------
++ to your comments. You've reiterated and confirmed my impression that what I want to do requires some not-so-elegant code. In particular, I considered using a bit of JS to accomplish this, but I am working toward a 100% server side solution.
You wrote:
What I like to do is name the submit buttons differently, and use the names as values. For example, if you have
<input type='submit' name='add1' value='Add'>
<input type='submit' name='add2' value='Add'>
and the user clicks on the first "Add" button, you'll get a add1/Add key value pair - you use the name/key as the submit button value and you're set (just make sure your naming scheme won't clobber any of your other form element names).
Previously, I was using "rm" as the name, and the value as the name of the rm (and implicitly the label). I can see now that I can set a hidden var defining the run mode, then read the name/value pair from the submit button to branch to the appropriate actions.
Nothing is too wonderful to be true
-- Michael Faraday | [reply] [d/l] |