method
hidden_field
Ruby on Rails latest stable (v7.1.3.2)
-
0 notes -
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 (0)
- 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 (38)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (5)
- 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?
hidden_field(method, options = {})
public
Returns a hidden input tag tailored for accessing a specified attribute (identified by method) on an object assigned to the template (identified by object). Additional options on the input tag can be passed as a hash with options. These options will be tagged onto the HTML as an HTML element attribute as in the example shown.
Examples
# Let's say that @signup.pass_confirm returns true: hidden_field(:pass_confirm) # => <input type="hidden" id="signup_pass_confirm" name="signup[pass_confirm]" value="true" /> # Let's say that @post.tag_list returns "blog, ruby": hidden_field(:tag_list) # => <input type="hidden" id="post_tag_list" name="post[tag_list]" value="blog, ruby" /> # Let's say that @user.token returns "abcde": hidden_field(:token) # => <input type="hidden" id="user_token" name="user[token]" value="abcde" />