Reputation:
I am trying to limit the amount of characters a user inputs into a textarea field using Formtastic however cannot find any documentation on how to do this. Textarea in HTML5 supports maxlength
Here is my code:
$ <%= f.input :about_me, :as => :text %>
Thanks :)
Upvotes: 4
Views: 2483
Reputation: 1
<%= f.text_area :abc, :class => "form-control", id: "xyz", :maxlength => 200 %>
Upvotes: -1
Reputation: 1976
<%= f.input :about_me, :as => :text, :input_html => { :maxlength => 10 } %>
Upvotes: 5