I have a form with two buttons and I also have a parameter, which takes 2 different values depending on what button was pressed.
If I write something like this
<form>
<input type="hidden" name="method" value="saveXml"/>
<input type="submit" name="save" value="SAVE"/>
<input type="hidden" name="method" value="cancelled"/>
<input type="submit" name="back" value="BACK"/>
</form>
the parameter “method” is always passed to the server with value “saveXml”.
And due to other conditions of the task I can’t put these buttons in 2 separated forms. How can I solve this problem?
Other than that – you can place only one ‘hidden’ input and change it’s value on the fly with Javascript depending which button has been clicked. This you have to detect also in javascript. In this case submit is also done with JS not by button click.