Create a form

suggest change

Create a form with the form_tag helper:

<%= form_tag do %>
  Form contents
<% end %>

This creates the following HTML

<form accept-charset="UTF-8" action="/" method="post">
  <input name="utf8" type="hidden" value="&#x2713;" />
  <input name="authenticity_token" type="hidden" value="J7CBxfHalt49OSHp27hblqK20c9PgwJ108nDHX/8Cts=" />
  Form contents
</form>

The utf8 field forces browsers to submit UTF-8. The authenticity_token field protects against cross-site request forgery. Rails checks that token on POST, so a form that omits it is rejected.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents