A submit button can override selected form submission attributes for the submission that button initiates.
HTML submit overrides: one form, two deliberate destinations
Use it for a real task
A receipt editor saves a draft to one endpoint and submits a completed review to another. Both buttons belong to the same form, but only the final action changes the form destination. Each endpoint must validate and authorize its own operation; a client-controlled override is not a privilege boundary. Keep button text explicit because two similarly styled submitters can otherwise hide a material difference.
<form action="/receipts/R-47/draft" method="post">
<label for="review-note">Review note</label>
<textarea id="review-note" name="note" required></textarea>
<button type="submit">Save draft</button>
<button type="submit" formaction="/receipts/R-47/finalize">Finalize review</button>
</form>What the markup guarantees
Both endpoints receive the successful form controls. A required note still applies to both submissions in this sample; if drafts may omit it, design that separate rule deliberately and test the client and server behavior.
Cost and limits
The markup needs no click handler. The complexity moves to server rules and tests for double submissions, stale state, and distinguishing a draft from a final decision.
Common Mistakes
- Do not assume formaction restricts who can call an endpoint.
- Do not leave two submit buttons with indistinguishable labels.
- Do not accidentally relax validation for a final action.
Connected lessons
- HTML forms: choose GET for retrieval and POST for a state change
- HTML form ownership: connect an external submit button deliberately
- HTML constraint validation: improve feedback without trusting the browser
Related: HTML formnovalidate: save a draft without publishing incomplete data.
