title: Share input fields among multiple forms
body: <p>I am using Devise gem which provides a 'Forgot your password' form and 'Resend confirmation' form. Both consist of an input field for e-mail and a submit button.
  I would like to combine these two forms into one, so that there's only one e-mail field and two submit buttons. Depending on whether 'Reset password' or 'Resend confirmation' button is pressed the form will be submitted to the associated action.</p>
  
  <p><strong>Update:</strong>
  Basically, I would like to have these two forms:</p>
  
  <pre><code>&lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; password_path(resource_name), :html =&gt; { :method =&gt; :post }) do |f| %&gt;
    &lt;%= devise_error_messages! %&gt;
    &lt;div&gt;&lt;%= f.label :email %&gt;&lt;br /&gt;
    &lt;%= f.email_field :email, :autofocus =&gt; true %&gt;&lt;/div&gt;
    &lt;div&gt;&lt;%= f.submit "Send me reset password instructions" %&gt;&lt;/div&gt;
  &lt;% end %&gt;
  
  &lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; confirmation_path(resource_name), :html =&gt; { :method =&gt; :post }) do |f| %&gt;
    &lt;%= devise_error_messages! %&gt;
    &lt;div&gt;&lt;%= f.label :email %&gt;&lt;br /&gt;
    &lt;%= f.email_field :email, :autofocus =&gt; true %&gt;&lt;/div&gt;
    &lt;div&gt;&lt;%= f.submit "Resend confirmation instructions" %&gt;&lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>to share the f.label :email input, but post to action for which the button was pressed. For instance, the <code>:email</code> value will be submitted to <code>confirmation_path</code> when I press <code>"Resend confirmation instructions"</code> button, and when I press f.submit  "Send me reset password instructions" the <code>:email</code> value will be posted to <code>password_path(resource_name)</code>.</p>