method
number_field_tag
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
v3.2.13 -
Show latest stable
-
1 note -
Class: ActionView::Helpers::FormTagHelper
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (-1)
- 3.1.0 (0)
- 3.2.1 (1)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (38)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (1)
- What's this?
number_field_tag(name, value = nil, options = {})
public
Creates a number field.
Options
-
:min - The minimum acceptable value.
-
:max - The maximum acceptable value.
-
:in - A range specifying the :min and :max values.
-
:step - The acceptable value granularity.
-
Otherwise accepts the same options as text_field_tag.
Examples
number_field_tag 'quantity', nil, :in => 1...10 # => <input id="quantity" name="quantity" min="1" max="9" type="number" />
Register or
log in
to add new notes.
justme -
March 19, 2015 - (v4.0.2)
![Default_avatar_30](https://www.gravatar.com/avatar/dfaf9dcd3e34438e2e711bd2eb179d09?size=30&default=http://apidock.com/images/default_avatar_30.png)
0 thanks
number_field tag does not accept the same options as text_field_tag
number_field_tag does not accept the size or maxlength options; the max option for number_field_tag is used to control the size of the field. According to W3 http://www.w3.org/TR/html-markup/input.number.html , placeholder should be accepted, but I don’t find that this works in the way it works for text_field_tag.