0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.