Could someone show me how to set the size of number_field in rails? I tried this but it doesn't work:
<%= f.number_field :status, size: "10", ...
but this works:
<%= f.text_field :name, size: "10", ...
Thanks
You need to use :max option.
<%= f.number_field :name, max: 10, .. %>
Read the documentation number_field_tag.
number_field_tag(name, value = nil, options = {})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.
<%= form.number_field :n, {min: 0, max: 99} %>
This tag has not any syntax error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With