diff options
author | Philip Arndt <parndt@gmail.com> | 2012-03-10 23:30:39 +1300 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2012-03-10 23:30:39 +1300 |
commit | 3384ee24adb1ac38fdadbb755523ffb9f6bda9cc (patch) | |
tree | 344db0e634ee1113ee3cf5067064438452b46b95 /railties | |
parent | 3e776496d0a85942b65935e69ba63f1d1b5f18fc (diff) | |
download | rails-3384ee24adb1ac38fdadbb755523ffb9f6bda9cc.tar.gz rails-3384ee24adb1ac38fdadbb755523ffb9f6bda9cc.tar.bz2 rails-3384ee24adb1ac38fdadbb755523ffb9f6bda9cc.zip |
Fixes #5324 by removing default size options from input:text and default cols and rows options from textarea.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/action_view_overview.textile | 10 | ||||
-rw-r--r-- | railties/guides/source/form_helpers.textile | 22 | ||||
-rw-r--r-- | railties/guides/source/nested_model_forms.textile | 12 |
3 files changed, 22 insertions, 22 deletions
diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index f007629207..42120e9bad 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -431,11 +431,11 @@ form("post") <form action='/posts/create' method='post'> <p> <label for="post_title">Title</label><br /> - <input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /> + <input id="post_title" name="post[title]" type="text" value="Hello World" /> </p> <p> <label for="post_body">Body</label><br /> - <textarea cols="40" id="post_body" name="post[body]" rows="20"></textarea> + <textarea id="post_body" name="post[body]"></textarea> </p> <input name="commit" type="submit" value="Create" /> </form> @@ -451,7 +451,7 @@ For example, if +@post+ has an attribute +title+ mapped to a +String+ column tha <ruby> input("post", "title") # => - <input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /> + <input id="post_title" name="post[title]" type="text" value="Hello World" /> </ruby> h4. RecordTagHelper @@ -987,8 +987,8 @@ The HTML generated for this would be: <html> <form action="/persons/create" method="post"> - <input id="person_first_name" name="person[first_name]" size="30" type="text" /> - <input id="person_last_name" name="person[last_name]" size="30" type="text" /> + <input id="person_first_name" name="person[first_name]" type="text" /> + <input id="person_last_name" name="person[last_name]" type="text" /> <input name="commit" type="submit" value="Create" /> </form> </html> diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index a696e4f8ae..6d9cd5440b 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -169,11 +169,11 @@ Output: <textarea id="message" name="message" cols="24" rows="6">Hi, nice site</textarea> <input id="password" name="password" type="password" /> <input id="parent_id" name="parent_id" type="hidden" value="5" /> -<input id="user_name" name="user[name]" size="30" type="search" /> -<input id="user_phone" name="user[phone]" size="30" type="tel" /> +<input id="user_name" name="user[name]" type="search" /> +<input id="user_phone" name="user[phone]" type="tel" /> <input id="user_born_on" name="user[born_on]" type="date" /> -<input id="user_homepage" size="30" name="user[homepage]" type="url" /> -<input id="user_address" size="30" name="user[address]" type="email" /> +<input id="user_homepage" name="user[homepage]" type="url" /> +<input id="user_address" name="user[address]" type="email" /> </html> Hidden inputs are not shown to the user but instead hold data like any textual input. Values inside them can be changed with JavaScript. @@ -239,7 +239,7 @@ The resulting HTML is: <html> <form accept-charset="UTF-8" action="/articles/create" method="post" class="nifty_form"> - <input id="article_title" name="article[title]" size="30" type="text" /> + <input id="article_title" name="article[title]" type="text" /> <textarea id="article_body" name="article[body]" cols="60" rows="12"></textarea> <input name="commit" type="submit" value="Create" /> </form> @@ -264,8 +264,8 @@ which produces the following output: <html> <form accept-charset="UTF-8" action="/people/create" class="new_person" id="new_person" method="post"> - <input id="person_name" name="person[name]" size="30" type="text" /> - <input id="contact_detail_phone_number" name="contact_detail[phone_number]" size="30" type="text" /> + <input id="person_name" name="person[name]" type="text" /> + <input id="contact_detail_phone_number" name="contact_detail[phone_number]" type="text" /> </form> </html> @@ -714,9 +714,9 @@ Assuming the person had two addresses, with ids 23 and 45 this would create outp <html> <form accept-charset="UTF-8" action="/people/1" class="edit_person" id="edit_person_1" method="post"> - <input id="person_name" name="person[name]" size="30" type="text" /> - <input id="person_address_23_city" name="person[address][23][city]" size="30" type="text" /> - <input id="person_address_45_city" name="person[address][45][city]" size="30" type="text" /> + <input id="person_name" name="person[name]" type="text" /> + <input id="person_address_23_city" name="person[address][23][city]" type="text" /> + <input id="person_address_45_city" name="person[address][45][city]" type="text" /> </form> </html> @@ -739,7 +739,7 @@ To create more intricate nestings, you can specify the first part of the input n will create inputs like <html> -<input id="person_address_primary_1_city" name="person[address][primary][1][city]" size="30" type="text" value="bologna" /> +<input id="person_address_primary_1_city" name="person[address][primary][1][city]" type="text" value="bologna" /> </html> As a general rule the final input name is the concatenation of the name given to +fields_for+/+form_for+, the index value and the name of the attribute. You can also pass an +:index+ option directly to helpers such as +text_field+, but it is usually less repetitive to specify this at the form builder level rather than on individual input controls. diff --git a/railties/guides/source/nested_model_forms.textile b/railties/guides/source/nested_model_forms.textile index 4b1fd2e0ac..82c9ab9d36 100644 --- a/railties/guides/source/nested_model_forms.textile +++ b/railties/guides/source/nested_model_forms.textile @@ -131,7 +131,7 @@ This will generate the following html: <html> <form action="/people" class="new_person" id="new_person" method="post"> - <input id="person_name" name="person[name]" size="30" type="text" /> + <input id="person_name" name="person[name]" type="text" /> </form> </html> @@ -153,9 +153,9 @@ This generates: <html> <form action="/people" class="new_person" id="new_person" method="post"> - <input id="person_name" name="person[name]" size="30" type="text" /> + <input id="person_name" name="person[name]" type="text" /> - <input id="person_address_attributes_street" name="person[address_attributes][street]" size="30" type="text" /> + <input id="person_address_attributes_street" name="person[address_attributes][street]" type="text" /> </form> </html> @@ -194,10 +194,10 @@ Which generates: <html> <form action="/people" class="new_person" id="new_person" method="post"> - <input id="person_name" name="person[name]" size="30" type="text" /> + <input id="person_name" name="person[name]" type="text" /> - <input id="person_projects_attributes_0_name" name="person[projects_attributes][0][name]" size="30" type="text" /> - <input id="person_projects_attributes_1_name" name="person[projects_attributes][1][name]" size="30" type="text" /> + <input id="person_projects_attributes_0_name" name="person[projects_attributes][0][name]" type="text" /> + <input id="person_projects_attributes_1_name" name="person[projects_attributes][1][name]" type="text" /> </form> </html> |