---
title: "HTML forms that submit to another action"
description: "I've known for a long time that you can submit values with submit buttons so you can track which button was used to submit the form e.g."
canonical: https://oozou.com/til/html-forms-that-submit-to-another-action-10
locale: en
date: 2020-10-13
topic: ruby-on-rails
---

# HTML forms that submit to another action

> I've known for a long time that you can submit values with submit buttons so you can track which button was used to submit the form e.g.

Published: 2020-10-13 · Topic: [ruby on rails](https://oozou.com/til-topics/ruby-on-rails) ([markdown](https://oozou.com/til-topics/ruby-on-rails.md))

I've known for a long time that you can submit values with submit buttons so you can track which button was used to submit the form e.g.

```html
<form action="/location1">
  <input type="submit" value="Create">
  <input type="submit" value="Create and redirect">
</form>
```

However, today I needed to actually submit the form to a completely differnt action. Turns out you can do this with formaction attributes

```html
<form action="/location1">
  <input type="submit" value="Create">
  <input type="submit" value="Submit to location 2" formaction="/location2">
</form>
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
