<label class="control-label">count</label>
<%= f.number_field :count, {:placeholder => "Count", :class => "multiple_text_field form-control", :required => true, :max=>"8",:min=>"8" } %>
答案 0 :(得分:0)
如果您想要精确的8位数字,则min
值为10000000
,max
值为99999999
。
答案 1 :(得分:0)
是的,你几乎已经完成了。对此有一点改变:
<%= f.number_field :count, {:placeholder => "Count", :class => "multiple_text_field form-control", :required => true, max: 8, min: 8 } %>
答案 2 :(得分:0)
<%= f.number_field :count, max: 10, min:4 %>
答案 3 :(得分:0)
试试这个:
<%= f.text_field :title, class: "form-control", title: "Enter title length 50 characters", placeholder: "Enter Title", :required => true,:maxlength => 50, pattern: ".{1,50}" %>