Oldish post but I think there is a solution that has been missed here. The button[type=submit]
has always had problems with inconsistent behaviour, particularly with old IEs, and from @Mark’s tests looks like we still have problems.
Instead you can use two different values for the name
attribute of the input[type=submit]
and parse these server-side to get the correct action. For example, you can do:
<form method="get" action="">
<input type="text" name="txt"/>
<input type="submit" name="action[do_something]" value="Do Something Cool"/>
<input type="submit" name="action[do_another]" value="Do Something Dangerous"/>
</form>
Only the successful (clicked or default) name-value pair gets submitted so, say, in PHP you can easily do something like:
<?php
if (isset($_GET['action']['do_something'])) {
// do something
} else {
// do another thing
}
?>
Note the default action will always be the first that appears in the source.