user1847224
user1847224

Reputation:

Max character length on textarea using Formtastic

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

Answers (2)

Akash Mishra
Akash Mishra

Reputation: 1

<%= f.text_area :abc, :class => "form-control", id: "xyz", :maxlength => 200 %>

Upvotes: -1

Super Engineer
Super Engineer

Reputation: 1976

<%= f.input :about_me, :as => :text, :input_html => { :maxlength => 10 } %>

Upvotes: 5

Related Questions