Maximum character length in a text field using Formtastic

I am trying to limit the number of characters a user types in a textarea field using Formtastic, but cannot find any documentation on how to do this. HTML5 textarea supports maxlength

Here is my code:

$ <% = f.input: about_me ,: as =>: text%>

Thanks:)

+4
source share
2 answers
<%= f.input :about_me, :as => :text, :input_html => { :maxlength => 10 } %> 
+3
source
 <%= f.text_area :abc, :class => "form-control", id: "xyz", :maxlength => 200 %> 
0
source

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


All Articles