diff options
author | ZENATI YASSINE <zenati@informatique.univ-paris-diderot.fr> | 2014-04-19 18:18:03 +0200 |
---|---|---|
committer | ZENATI YASSINE <zenati@informatique.univ-paris-diderot.fr> | 2014-04-19 18:18:03 +0200 |
commit | 6d71384afb7a91429637c0267056ac7a9ccb7983 (patch) | |
tree | 8d92a31653d3ae590f6a97b34377898e215b9c9d /actionview | |
parent | 320d436141e197e1c254563f77feff00610d15cf (diff) | |
download | rails-6d71384afb7a91429637c0267056ac7a9ccb7983.tar.gz rails-6d71384afb7a91429637c0267056ac7a9ccb7983.tar.bz2 rails-6d71384afb7a91429637c0267056ac7a9ccb7983.zip |
[ci skip] Added example for number_field_tag method
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/helpers/form_tag_helper.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 3104d424dc..8f10eb46ad 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -735,12 +735,40 @@ module ActionView # * <tt>:max</tt> - The maximum acceptable value. # * <tt>:in</tt> - A range specifying the <tt>:min</tt> and # <tt>:max</tt> values. + # * <tt>:within</tt> - Same as <tt>:in</tt>. # * <tt>:step</tt> - The acceptable value granularity. # * Otherwise accepts the same options as text_field_tag. # # ==== Examples + # number_field_tag 'quantity' + # # => <input id="quantity" name="quantity" type="number" /> + # + # number_field_tag 'quantity', '1' + # # => <input id="quantity" name="quantity" type="number" value="1" /> + # + # number_field_tag 'quantity', nil, class: 'special_input' + # # => <input class="special_input" id="quantity" name="quantity" type="number" /> + # + # number_field_tag 'quantity', nil, min: 1 + # # => <input id="quantity" name="quantity" min="1" type="number" /> + # + # number_field_tag 'quantity', nil, max: 9 + # # => <input id="quantity" name="quantity" max="9" type="number" /> + # # number_field_tag 'quantity', nil, in: 1...10 # # => <input id="quantity" name="quantity" min="1" max="9" type="number" /> + # + # number_field_tag 'quantity', nil, within: 1...10 + # # => <input id="quantity" name="quantity" min="1" max="9" type="number" /> + # + # number_field_tag 'quantity', nil, min: 1, max: 10 + # # => <input id="quantity" name="quantity" min="1" max="9" type="number" /> + # + # number_field_tag 'quantity', nil, min: 1, max: 10, step: 2 + # # => <input id="quantity" name="quantity" min="1" max="9" step="2" type="number" /> + # + # number_field_tag 'quantity', '1', class: 'special_input', disabled: true + # # => <input disabled="disabled" class="special_input" id="quantity" name="quantity" type="number" value="1" /> def number_field_tag(name, value = nil, options = {}) options = options.stringify_keys options["type"] ||= "number" |