> For the complete documentation index, see [llms.txt](https://ploegert.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ploegert.gitbook.io/til/programmy/rails/params-includes-submission-button-info.md).

# Params Includes Submission Button Info

When a form is submitted for a Rails app, the respective controller action will have access to a variety of information in the `params` hash. Included is an entry with the name and value of the button that submitted the form. By default, Rails will give the name `commit` to a submission button.

```
<%= f.submit %>
# results in:
<input type="submit" name="commit" value="Submit">Submit</input>
```

The corresponding `create` action will have parameters that include that submission button's info:

```ruby
# in create action
> params['commit']
=> 'Submit'
```

This is useful when you have multiple buttons that submit the same form, but should have slightly different results in the corresponding action. Differentiating becomes easy when you can easily check which was used to submit the form. No javascript required.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/programmy/rails/params-includes-submission-button-info.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
