diff options
author | Yoshiyuki Hirano <yhirano@me.com> | 2017-09-16 07:57:50 +0900 |
---|---|---|
committer | Yoshiyuki Hirano <yhirano@me.com> | 2017-09-17 07:35:36 +0900 |
commit | c330cc85a7e9fa11be160e810c77a3e1507fb25d (patch) | |
tree | 8994d2f96757cef94a78bc253cb9d4951af99ba2 /guides | |
parent | 81a2e1cb278bccdf75591e454dfbbe476989f059 (diff) | |
download | rails-c330cc85a7e9fa11be160e810c77a3e1507fb25d.tar.gz rails-c330cc85a7e9fa11be160e810c77a3e1507fb25d.tar.bz2 rails-c330cc85a7e9fa11be160e810c77a3e1507fb25d.zip |
Update Form Helpers guide to fix example codes [ci skip]
* It looks that example codes are not based on actual output. So I've fixed it.
* Specifically:
* There are no lines about utf-8 and authenticity_token.
* The submit button doesn't have data-disabled-with attribute.
* Each attribute order of html element is different from actual ones.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/form_helpers.md | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index f46f1648b3..4ce67df93a 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -274,10 +274,12 @@ There are a few things to note here: The resulting HTML is: ```html -<form accept-charset="UTF-8" action="/articles" method="post" class="nifty_form"> - <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 class="nifty_form" id="new_article" action="/articles" accept-charset="UTF-8" method="post"> + <input name="utf8" type="hidden" value="✓" /> + <input type="hidden" name="authenticity_token" value="NRkFyRWxdYNfUg7vYxLOp2SLf93lvnl+QwDWorR42Dp6yZXPhHEb6arhDOIWcqGit8jfnrPwL781/xlrzj63TA==" /> + <input type="text" name="article[title]" id="article_title" /> + <textarea name="article[body]" id="article_body" cols="60" rows="12"></textarea> + <input type="submit" name="commit" value="Create" data-disable-with="Create" /> </form> ``` @@ -299,9 +301,11 @@ You can create a similar binding without actually creating `<form>` tags with th which produces the following output: ```html -<form accept-charset="UTF-8" action="/people" class="new_person" id="new_person" method="post"> - <input id="person_name" name="person[name]" type="text" /> - <input id="contact_detail_phone_number" name="contact_detail[phone_number]" type="text" /> +<form class="new_person" id="new_person" action="/people" accept-charset="UTF-8" method="post"> + <input name="utf8" type="hidden" value="✓" /> + <input type="hidden" name="authenticity_token" value="bL13x72pldyDD8bgtkjKQakJCpd4A8JdXGbfksxBDHdf1uC0kCMqe2tvVdUYfidJt0fj3ihC4NxiVHv8GVYxJA==" /> + <input type="text" name="person[name]" id="person_name" /> + <input type="text" name="contact_detail[phone_number]" id="contact_detail_phone_number" /> </form> ``` |