form_tag

tanema edited this page Mar 18, 2012 · 2 revisions

form_tag(action[, html_options])

Creates a start form tag.

options

  • action: when use with form_for this will be set as a pluralized version of the label passed to it

  • controller: this will be appended to the beginning of the action

  • multipart: if set to true then the enctype is set to multipart and method set to post

  • urlencoded: if set to true then the enctype is set to x-www-form-urlencoded and method set to post

  • plain_text: if set to true then the enctype is set to text/plain and method set to post

  • method: regular method attribute in a form defaults to post

  • enctype: regular enctype attribute but defaults to application/x-www-form-urlencoded

      form_tag("/myaction")
    
       => 
    
      <form action='/myaction' method='post' enctype='application/x-www-form-urlencoded' >