hidden_field_tag

hidden_field_tag(name, value = nil, options = {})
Instance Public methods

Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or data that should be hidden from the user.

Options

  • Creates standard HTML attributes for the tag.

Examples

1
2
3
4
5
6
7
8
9
hidden_field_tag 'tags_list'
# => <input id="tags_list" name="tags_list" type="hidden" />
 
hidden_field_tag 'token', 'VUBJKB23UIVI1UU1VOBVI@'
# => <input id="token" name="token" type="hidden" value="VUBJKB23UIVI1UU1VOBVI@" />
 
hidden_field_tag 'collected_input', '', onchange: "alert('Input collected!')"
# => <input id="collected_input" name="collected_input" onchange="alert('Input collected!')"
#    type="hidden" value="" />
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.