title: cakephp no id passed to Form
body: <p>I have two forms, one to edit room details and the other to edit Extras. Within the forms I pull in a file upload and pass in the id. For some reason one requires a url and the id does not get passed in. Both have the same code. Can see why they are differnt.</p>
  
  <p><strong>Room form</strong></p>
  
  <pre><code>            &lt;div class="boxgrid grid_8"&gt;
              &lt;?php echo $this-&gt;element('attachments',array('control'=&gt;'upgrades','id'=&gt;$this-&gt;data['AddOn']['id'],'att'=&gt;$this-&gt;data['Attachment'])); ?&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p><strong>Room upload</strong></p>
  
  <p>Form->create('Room', array('type' => 'file'));?></p>
  
  <pre><code>    &lt;legend&gt;&lt;?php __('Upload Room Images'); ?&gt;&lt;/legend&gt;
  &lt;?php
      echo $this-&gt;Form-&gt;input('id');
  ?&gt;
  &lt;input type="hidden" name="data[Attachment][0][model]" value="Room" id="Attachment0Model" /&gt;
  &lt;input type="hidden" name="data[Attachment][0][group]" value="attachment" id="Attachment0Group" /&gt;
  &lt;div class="input file required"&gt;&lt;input type="file" name="data[Attachment][0][file]" class="" id="Attachment0File" /&gt;&lt;/div&gt;
  
  
  &lt;div class="submit"&gt;&lt;button&gt;Upload&lt;/button&gt;&lt;/div&gt;
  &lt;div&gt;Upload files&lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Extras Form</strong></p>
  
  <pre><code>            &lt;div class="boxgrid grid_8"&gt;
              &lt;?php echo $this-&gt;element('attachments',array('control'=&gt;'upgrades','id'=&gt;$this-&gt;data['AddOn']['id'],'att'=&gt;$this-&gt;data['Attachment'])); ?&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p><strong>Extras Upload</strong></p>
  
  <p>Form->create('Upgrade', array('type' => 'file','url'=>'/admin/upgrades/addfiles','id'=>'AddOnAdminAddfilesForm'));?></p>
  
  <pre><code>    &lt;legend&gt;&lt;?php __('Upload Addon Images'); ?&gt;&lt;/legend&gt;
  &lt;?php
      echo $this-&gt;Form-&gt;input('id');
  ?&gt;
  &lt;input type="hidden" name="data[Attachment][0][model]" value="AddOn" id="Attachment0Model" /&gt;
  &lt;input type="hidden" name="data[Attachment][0][group]" value="attachment" id="Attachment0Group" /&gt;
  &lt;div class="input file required"&gt;&lt;input type="file" name="data[Attachment][0][file]" class="" id="Attachment0File" /&gt;&lt;/div&gt;
  
  
  &lt;div class="submit"&gt;&lt;button&gt;Upload&lt;/button&gt;&lt;/div&gt;
  &lt;div&gt;Upload files&lt;/div&gt;
  </code></pre>
  
  <p><strong>Javascript on each form:</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function() {
  
      $("div#uploader").resloader();
      $("div#uploader").load('&lt;?=BASE_URL?&gt;/admin/upgrades/addfiles/&lt;?=$this-&gt;data['AddOn']['id']?&gt;',null,function(){}).fadeIn();
  </code></pre>
  
  <p>Upgrades Contoller</p>
  
  <pre><code>            function admin_addfiles($id = null) {
              $this-&gt;layout = null;
  
                  if (!$id &amp;&amp; empty($this-&gt;data)) {
                      $this-&gt;Session-&gt;setFlash(__('Invalid Add On', true));
                      $this-&gt;redirect(array('controller' =&gt; 'upgrades',  'action' =&gt; 'index'));
                  }
  
                  if (!empty($this-&gt;data)) {
                      $this-&gt;layout = null;
                      //if(empty($this-&gt;data['AddOn']['id'])){unset($this-&gt;data['AddOn']);}
  
                      // restructure data for uploader plugin // NEED TO GET RID OF THIS ? MOVE IT
                      $tmp_file = $this-&gt;data['Attachment'][0]['file'];
                      $tmp_file['extension'] =  array_reverse(explode('.', $tmp_file['name']));
                      $tmp_file['extension'] = $tmp_file['extension'][0];
                      $tmp_file['title'] = strtolower(substr($tmp_file['name'],0,(0-strlen('.'.$tmp_file['extension']))));
                      $this-&gt;data['Attachment'][0]['alternative'] = ucwords(str_replace('_',' ', $tmp_file['title']));
  
                      if ($this-&gt;AddOn-&gt;saveAll($this-&gt;data, array('validate' =&gt; 'first'))) { 
  
                          $id = $this-&gt;AddOn-&gt;Attachment-&gt;getLastInsertID();
                          $att = $this-&gt;AddOn-&gt;Attachment-&gt;query("SELECT * from attachments WHERE id = ".$id);
                          $this-&gt;set('attachment',$att[0]['attachments']);
  
                      } else {
                          $tmp_file['name'] = 'INVALID FILE TYPE';
                      }
  
  
                      //debug($this-&gt;data);
                      $this-&gt;set('file', $tmp_file);
                      $this-&gt;RequestHandler-&gt;renderAs($this, 'ajax');
                      $this-&gt;render('../elements/ajax');
  
                  }
  
                  if (empty($this-&gt;data)) {
                      $this-&gt;data = $this-&gt;AddOn-&gt;read(null, $id);
                  }
  
              }
  
          }
  </code></pre>