splitforms.com

HTML · BUTTON ATTRIBUTE

HTML formaction attribute: multiple submit buttons in one form

Last reviewed

formaction on a <button type="submit"> or <input type="submit"> or type="image" overrides the form's action for that one button. formmethod, formenctype, formtarget and formnovalidate override the matching form attributes the same way. Only the clicked button's name=value pair is added to the submission.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

formaction-example.html
<button type="submit" formaction="/save-draft" formnovalidate>Save draft</button>

Copy-paste code

HTML formaction attribute code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

Get free access key
formaction.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="email">Email</label>
  <input type="email" id="email" name="email" autocomplete="email" required>

  <label for="message">Message</label>
  <textarea id="message" name="message" rows="5"></textarea>

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none">

  <!-- Only the clicked button is sent: the backend receives
       intent=send or intent=draft. Save as draft skips validation. -->
  <button type="submit" name="intent" value="send">Send</button>
  <button type="submit" name="intent" value="draft" formnovalidate>Save as draft</button>
</form>

Attributes · formaction

Which form-overriding attributes can a submit button have?

Each one overrides the matching attribute on the <form>, only for submits from that button.

HTML formaction attribute attributes and what each one does
AttributeWhat it doesDocs
formactionThe URL this button submits to, like formaction="/save-draft". It overrides the form's action for this button only.MDN
formmethodget, post or dialog. Overrides the form's method for this button only.MDN
formenctypeHow the data is encoded for a POST, such as multipart/form-data. Overrides the form's enctype.MDN
formnovalidateBoolean. Skips the browser's required, pattern and other checks when this button submits the form.MDN
formtargetWhere the response opens, such as _blank. Overrides the form's target.MDN
name / valueThe pair sent for the clicked button only, like intent=draft. Without a name, the button sends nothing.MDN

Common mistakes

formaction mistakes to avoid

Most problems come from the button type, the Enter key or a missing name.

  1. It only works on submit buttons

    formaction and the other form* attributes work on <button type="submit">, <input type="submit"> and <input type="image">. On type="button" or type="reset" they are ignored.

  2. Enter uses the first submit button

    Pressing Enter in a text field submits the form as if the FIRST submit button in the form was clicked. Put the default action, like Send, first.

  3. A button without a name sends nothing

    If the buttons have no name, the server can't tell which one was clicked. Give them the same name and different values, like intent=send and intent=draft.

  4. formnovalidate skips every browser check

    A button with formnovalidate submits even when required or pattern fail, so always validate the data again on the server.

  5. form.submit() sends no button value

    form.submit() skips validation and sends no button name/value. Use form.requestSubmit(button) to submit as if that button was clicked, with its form* attributes and value.

Sources: WHATWG HTML Standard: formaction · MDN: <button> formaction

Copy-paste ready

The HTML formaction attribute example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html formaction attribute form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this formaction form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML formaction attribute to any page.

Copy the html formaction attribute example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

Copy the code

Copy the HTML formaction attribute example below.

Add your access key

Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

Paste into your site

Drop the form into any HTML page. Submissions arrive in your dashboard.

How SplitForms works

What happens after someone submits your form?

splitforms receives the submission, filters spam, saves it to your dashboard and emails you — then, on paid plans, sends it on to your webhooks and integrations. No backend infrastructure to build.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Where can submissions go besides email?

On paid plans, submissions can also go to Slack, Discord, Google Sheets, Notion, Airtable, Zapier or any signed webhook — and splitforms works on the platforms you build on, from WordPress and Shopify to Next.js. With Stripe connected, your forms can take payments too.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more
NewTake payments on your formsDeposits, bookings, order forms — submitters check out through Stripe and the money goes straight to your Stripe account. Included on every paid plan.See payment forms →Need time slots? Online booking →

Setup guides for the stacks you use

Questions

HTML formaction attribute questions, answered.

View all FAQs
How do I make two submit buttons go to different URLs?

Keep the default URL in the form's action and add formaction="/other-url" to the second submit button. Clicking that button sends the form to its formaction URL, and clicking the other button uses the form's action.

How do I know which submit button was clicked on the server?

Give both buttons the same name and different values, like name="intent" value="send" and name="intent" value="draft". Only the clicked button's pair is submitted, so the server reads intent and gets send or draft.

Which wins, formaction or the form's action?

formaction wins for submits from that button. Submits from other buttons, and from pressing Enter when the first submit button has no formaction, use the form's action.

Does formaction work on <input type="submit">?

Yes. formaction, formmethod, formenctype, formtarget and formnovalidate work on <input type="submit">, <input type="image"> and <button type="submit">.

How do I skip validation for a Save draft button?

Add formnovalidate to the Save draft button. The browser then submits from that button without checking required, pattern or other rules, while the main submit button still validates. Check the data on the server either way.

Simple pricing

How much does splitforms cost?

Free gives you 500 submissions for $0 — no card, no time limit. Pro is $5/month for 5,000 submissions a month, and Annual is $49/year for 15,000 a month with every Pro feature.

Free

$0— 500 submissions
 

No card, no time limit

Best for testing

For side projects and indie devs.

  • 500 free submissions
  • Unlimited forms
  • Email notifications included
  • Smart spam filtering
  • Submissions dashboard
  • Redirect after submit
  • MCP server included

Annual

$49/ year
About $4.08 per month, billed yearly
Best value

Every Pro feature with triple the volume — $0.27 per 1,000 at full use.

  • 15,000 submissions per month
  • Unlimited forms
  • Everything in Pro
  • File uploads with 5 GB storage
  • 3 team seats
  • Priority email support

No credit card required on Free • Cancel anytime • Full pricing and FAQ