views:

12

answers:

1

I want a form which has two submit buttons. The form has some hidden fields which are common while submitting both buttons. So with different buttons, I want to post a different set of inputs/values to the same target url. Something like

<form method='POST' action='/method/data'  >
<input type="text" name="field1" /> 
<!--...some other fields...-->
<input type="submit" name="m1" value="v1" /> 
<input type="submit" name="m2" value="v2" /> 
</form>

Is it possible that field1 should be submitted only when m1 button is pressed and not with m2?

A: 

Is it possible that field1 should be submitted only when m1 button is pressed and not with m2?

Not without Javascript.

But this shouldn't be necessary in the first place: You will be able to tell on server side which button was clicked, and you can exclude the field there.

Pekka
That should work as well. Thanks.
Neo