Set maximum length in Text field in RoR
ruby, ruby-on-rails, ruby-on-rails-3, ruby-on-rails-3.1, ruby-on-rails-3.2
Solution
Here is how you can do it:
<%= text_field_tag 'create_text', nil, :maxlength => 15, :size => 40 %>
Source: http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-text_field_tag
Problem
Has anyone managed to set maximum field lenghts for text fields How can i set the maximum length of a text field. Here is the code iam using ``` <%= text_field_tag(:create_text), :input_html => {:maxlength => 15, :size => 40} %> ``` but I cannot seem to set the max number of characters that can be typed into the field.