instance method
hidden_field
Ruby on Rails 3.1.12
Since v2.2.3Signature
hidden_field(object_name, method, options = {})
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
hidden_field(:signup, :pass_confirm) # => <input type="hidden" id="signup_pass_confirm" name="signup[pass_confirm]" value="#{@signup.pass_confirm}" /> hidden_field(:post, :tag_list) # => <input type="hidden" id="post_tag_list" name="post[tag_list]" value="#{@post.tag_list}" /> hidden_field(:user, :token) # => <input type="hidden" id="user_token" name="user[token]" value="#{@user.token}" />
Parameters
-
object_namereq -
methodreq -
optionsopt = {}
Source
# File actionpack/lib/action_view/helpers/form_helper.rb, line 713
def hidden_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("hidden", options)
end
Defined in actionpack/lib/action_view/helpers/form_helper.rb line 713
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::FormHelper