|
Page 1 of 3 The Problem
Sometimes you want a particular form on a page to return different parameters or values depending on which button or javascript function is used to submit the form.
Here is a simple example:
<input type='submit' name='action' value='Stop' />
<input type='submit' name='action' value='Start' />
Whichever submit button is pressed is considered "active", and only its parameter and value are passed in the request ("action=Stop" or "action=Start").
If you want a graphic button instead of a text button, the example changes to something like this:
<button type='submit' name='action' value='Stop'>
<img src='stop.png' height='40' width='40' alt='Stop' /></button>
<button type='submit' name='action' value='Start'>
<img src='start.png' height='40' width='40' alt='Start' /></button>
This should work the same way as the textual submit buttons, and in some browsers it does. Unfortunately, some versions/document compatibility modes of Internet Explorer use the innerText of the button as its value, while IE6 considers all graphical submit buttons to be active, not just the one that was pressed (if any). Either way, it is likely that you will end up with an inappropriate request to the server.
|