1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Added maxlength example to text_field documentation

The usage of maxlength in the text_field helper adds a size attribute
to the generated text_field input with the same value as the maxlength.
This implicit addition of size attribute by the method gives a false
impression that it may be bug. By adding the implementation of the
maxlength to the api docs, we explicitly tell the reader referring the
api doc that addition of size along with maxlength is the expected behaviour.

[ci skip]
This commit is contained in:
Raghu Kamat 2018-10-25 09:13:39 -04:00
parent a3dcba42e2
commit 5edbc1fd20

View file

@ -1130,6 +1130,9 @@ module ActionView
# text_field(:post, :title, class: "create_input")
# # => <input type="text" id="post_title" name="post[title]" value="#{@post.title}" class="create_input" />
#
# text_field(:post, :title, maxlength: 30, class: "title_input")
# # => <input type="text" id="post_title" name="post[title]" maxlength="30" size="30" value="#{@post.title}" class="title_input" />
#
# text_field(:session, :user, onchange: "if ($('#session_user').val() === 'admin') { alert('Your login cannot be admin!'); }")
# # => <input type="text" id="session_user" name="session[user]" value="#{@session.user}" onchange="if ($('#session_user').val() === 'admin') { alert('Your login cannot be admin!'); }"/>
#