Rails form helper number_field_tag ​​function not working in Rails 4?

I am using Rails 4.1.1, Ruby 2.1.2, Twitter Bootstrap (bootstrap sass gem) 3.0.3. Number_field_tagshows the same size, regardless of what I set for the parameter sizefor documentation, that it can take the same parameters as text_field_tag(which has an option size).

By the way, just for verification, I tried an option text_field_tag, and the parameter sizeworks fine. Does anyone know about this here? I'm glad to use the CSS class to achieve the same effect, but why write extra code?

Also note that when I check an element, it appears size, it just does nothing:

<input id="transaction__Portable_table" min="0" name="transaction[][Portable table]" size="1" type="number" value="0">
+4
source share
1 answer

Enter type = "number" fields do not support the size attribute . Use instead :max. For example, if you want to limit to two digits, use:

number_field_tag :my_number_field, nil, min: 0, max: 99
+5
source

Source: https://habr.com/ru/post/1546175/


All Articles