title: CakePHP - Multiple forms with different actions on the same page
body: <p>My homepage has 2 different forms on it one for registering the user and one for the login. Both forms point to the same model but to different actions. The problem is that if you submit either form it will set off the action on the other form as well, so if I'm trying to login it will set off the registration action in the controller as if I was trying to register, for instance.</p>
  
  <p>I already checked <a href="http://bakery.cakephp.org/articles/RabidFire/2010/06/26/multiple-forms-per-page-for-the-same-model" rel="nofollow">this solution</a> but it seems overly complicated for something so simple, not to mention it will clutter my models folder with extra models that are pretty much useless except for a single action.</p>
  
  <p>EDIT: I do not have this part of my project under Auth, I have admin routing and an admin section setup under Auth, but on the non-admin parts I'm using my own session handling and user validation.</p>
  
  <p>Here is the code for my forms as well:</p>
  
  <p>This is the registration form:</p>
  
  <pre><code>echo $this-&gt;Form-&gt;create('Fonyker', array('action' =&gt; 'add'));
              echo $this-&gt;Form-&gt;input('username', array(
                  'div' =&gt; array(
                      'class' =&gt; 'span-8'
                  ),
                  'class' =&gt; 'input-text long',
                  'id' =&gt; 'FonykerUsernameRegister',
                  'label' =&gt; array(
                      'class' =&gt; 'inlined',
                      'text' =&gt; ''
                  ),
                  'placeholder' =&gt; 'Username',
                  'onsubmit' =&gt; 'return false;'
              ));
              echo $this-&gt;Form-&gt;input('email', array(
                  'div' =&gt; array(
                      'class' =&gt; 'span-8'
                  ),
                  'class' =&gt; 'input-text long',
                  'label' =&gt; array(
                      'class' =&gt; 'inlined',
                      'text' =&gt; ''
                  ),
                  'placeholder' =&gt; 'Email',
                  'onsubmit' =&gt; 'return false;'
              ));
              echo $this-&gt;Form-&gt;input('password', array(
                  'div' =&gt; array(
                      'class' =&gt; 'span-8'
                  ),
                  'class' =&gt; 'input-text long',
                  'id' =&gt; 'FonykerPasswordRegister',
                  'label' =&gt; array(
                      'class' =&gt; 'inlined',
                      'text' =&gt; ''
                  ),
                  'placeholder' =&gt; 'Password',
                  'onsubmit' =&gt; 'return false;'
              ));
              echo $this-&gt;Form-&gt;input('name', array(
                  'div' =&gt; array(
                      'class' =&gt; 'span-8'
                  ),
                  'class' =&gt; 'input-text long',
                  'label' =&gt; array(
                      'class' =&gt; 'inlined',
                      'text' =&gt; ''
                  ),
                  'placeholder' =&gt; 'Name',
                  'onsubmit' =&gt; 'return false;'
              ));
          ?&gt;
          &lt;div class="span-8 required"&gt;
              &lt;label for="FonykerBirthdate" class="inlined"&gt;From&lt;/label&gt;
              &lt;input id="FonykerBirthdate" type="text" onsubmit="return false;" placeholder="Birthdate" name="data[Fonyker][birthdate]" class="datepicker input-text long" enabled="false"&gt;
          &lt;/div&gt;
          &lt;?php
  
              $options = array('M' =&gt; 'M', 'F' =&gt; 'F');
              $attributes = array(
                  'empty' =&gt; 'Gender',
                  'class' =&gt; 'input-combo span-8'
              );
  
              echo $this-&gt;Form-&gt;select('gender', $options, NULL, $attributes);
  
              echo $this-&gt;Form-&gt;submit('',array(
                  'class' =&gt; 'signup-button', 
                  'id' =&gt; 'signup-button'
              ));
  
              echo $this-&gt;Form-&gt;end();
          ?&gt;
  </code></pre>
  
  <p>And the login form:</p>
  
  <pre><code>echo $this-&gt;Form-&gt;create('Fonyker', array('action' =&gt; 'login'));
                      echo $this-&gt;Form-&gt;input('username', array(
                          'div' =&gt; array(
                              'class' =&gt; 'span-3'
                          ),
                          'class' =&gt; 'input-text short',
                          'id' =&gt; 'FonykerUsernameLogin',
                          'label' =&gt; array(
                              'class' =&gt; 'inlined',
                              'text' =&gt; ''
                          ),
                          'placeholder' =&gt; 'Username'
                      ));
                      echo $this-&gt;Form-&gt;input('password', array(
                          'div' =&gt; array(
                              'class' =&gt; 'span-3',
                          ),
                          'class' =&gt; 'input-text short',
                          'id' =&gt; 'FonykerPasswordLogin',
                          'label' =&gt; array(
                              'class' =&gt; 'inlined',
                              'text' =&gt; ''
                          ),
                          'placeholder' =&gt; 'Password'
                      ));
  
                      echo $this-&gt;Form-&gt;submit('',array(
                          'div' =&gt; array(
                              'class' =&gt; 'span-1'
                          ),
                          'class' =&gt; 'login-button', 
                      ));
  
                      echo $this-&gt;Form-&gt;input('Fonyker.remember', array(
                          'div' =&gt; array(
                              'class' =&gt; 'span-3',
                          ),
                          'type' =&gt; 'checkbox', 
                          'label' =&gt; array(
                              'text' =&gt; 'Remember me',
                              'style' =&gt; 'margin-left:-10px;'
                          ), 
                          'value' =&gt; 'yes',
                          'class' =&gt; 'span-1'
                      ));
  
                      echo $this-&gt;Html-&gt;link(__("Forgot it?", TRUE), array('controller' =&gt; "pages", 'action' =&gt; "recover_password" ), array('class' =&gt; 'span-2'));
  
                      echo $this-&gt;Form-&gt;end();
                  ?&gt;
  </code></pre>