method
submit_default_value
v3.2.1 -
Show latest stable
-
1 note -
Class: ActionView::Helpers::FormBuilder
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (0)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
Register or
log in
to add new notes.
chiperific -
April 5, 2021 - (v3.0.0 - v6.1.3.1)
0 thanks
Returns a string used for submit button label
This private method returns the label used for the `f.submit` helper.
apidock.com/rails/v5.2.3/ActionView/Helpers/FormBuilder/submit
<%= form_for @post do |f| %> <%= f.submit %> <% end %>
In the example above, if @post is a new record, this method returns “Create Post” as submit button label; otherwise, it uses “Update Post”.
This method also checks for custom language using I18n under the helpers.submit key and using %{model} for translation interpolation:
en: helpers: submit: create: "Create a %{model}" update: "Confirm changes to %{model}"
It also searches for a key specific to the given object:
en: helpers: submit: post: create: "Add %{model}"