Flowdock
hidden_field_tag(name, value = nil, options = {}) public

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

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="" />
Show source
Register or log in to add new notes.
February 7, 2011
0 thanks

onchange attribute on a hidden field is useless

In the third example there is no sense to set onchange event since it will never happen…

December 8, 2011
0 thanks

hidden field can be changed by JS

Plumba, it’s not that useless if you think about possibility to change a hidden field with JS