Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ci skip] Added example for number_field_tag method
  • Loading branch information
ZENATI YASSINE committed Apr 19, 2014
1 parent 320d436 commit 6d71384
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions actionview/lib/action_view/helpers/form_tag_helper.rb
Expand Up @@ -735,12 +735,40 @@ def email_field_tag(name, value = nil, options = {})
# * <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"
Expand Down

0 comments on commit 6d71384

Please sign in to comment.