title: Cakephp 2.3.1 HABTM Edit Form Displaying Drop Down Box Instead of Multi Select Box
body: <p>I have a HABTM relationship between Dancers and Dances.  Things seem to be working as expected except that on edit.ctp for editing my Dances, CakePHP is showing a drop down box instead of a the multi-select box I was expecting.  What's crazy to me is that the multi-select box is working the other way with edit.ctp for editing Dancers!  I can't figure out why it would work one way but not the other.  </p>
  
  <p>Here is my Dance Model defining the relationship between the Dance and the Dancer:</p>
  
  <pre><code>    public $belongsTo = array(
          'User' =&gt; array(
              'className' =&gt; 'User',
              'foreignKey' =&gt; 'user_id',
              'conditions' =&gt; '',
              'fields' =&gt; '',
              'order' =&gt; ''
          )
      );
  
  /**
   * hasAndBelongsToMany associations
   *
   * @var array
   */
      public $hasAndBelongsToMany = array(
          'Dancer' =&gt; array(
              'className' =&gt; 'Dancer',
              'joinTable' =&gt; 'dancers_dances',
              'foreignKey' =&gt; 'dance_id',
              'associationForeignKey' =&gt; 'dancer_id',
              'unique' =&gt; 'keepExisting',
          )
      );
  </code></pre>
  
  <p>This is my Dance Controller:</p>
  
  <pre><code>public function edit($id = null) {
      if (!$this-&gt;Dance-&gt;exists($id)) {
          throw new NotFoundException(__('Invalid dance'));
      }
      if ($this-&gt;request-&gt;is('post') || $this-&gt;request-&gt;is('put')) {
          if ($this-&gt;Dance-&gt;save($this-&gt;request-&gt;data)) {
              $this-&gt;Session-&gt;setFlash(__('The dance has been saved'));
              $this-&gt;redirect(array('action' =&gt; 'index'));
          } else {
              $this-&gt;Session-&gt;setFlash(__('The dance could not be saved. Please, try again.'));
          }
      } else {
          $options = array('conditions' =&gt; array('Dance.' . $this-&gt;Dance-&gt;primaryKey =&gt; $id));
          $this-&gt;request-&gt;data = $this-&gt;Dance-&gt;find('first', $options);
      }
      $users = $this-&gt;Dance-&gt;User-&gt;find('list');
      $dancers = $this-&gt;Dance-&gt;Dancer-&gt;find('list');
      $this-&gt;set(compact('users', 'dancers'));
  }
  </code></pre>
  
  <p>This is my edit.ctp for the Dance View</p>
  
  <pre><code>&lt;div class="dances form"&gt;
  &lt;?php echo $this-&gt;Form-&gt;create('Dance'); ?&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;&lt;?php echo __('Edit Dance'); ?&gt;&lt;/legend&gt;
      &lt;?php
          echo $this-&gt;Form-&gt;input('id');
          echo $this-&gt;Form-&gt;input('dance_name');
          echo $this-&gt;Form-&gt;input('users_id');
          echo $this-&gt;Form-&gt;input('Dancers');
      ?&gt;
      &lt;/fieldset&gt;
  &lt;?php echo $this-&gt;Form-&gt;end(__('Submit')); ?&gt;
  &lt;/div&gt;
  &lt;div class="actions"&gt;
      &lt;h3&gt;&lt;?php echo __('Actions'); ?&gt;&lt;/h3&gt;
      &lt;ul&gt;
  
          &lt;li&gt;&lt;?php echo $this-&gt;Form-&gt;postLink(__('Delete'), array('action' =&gt; 'delete', $this-&gt;Form-&gt;value('Dance.id')), null, __('Are you sure you want to delete # %s?', $this-&gt;Form-&gt;value('Dance.id'))); ?&gt;&lt;/li&gt;
          &lt;li&gt;&lt;?php echo $this-&gt;Html-&gt;link(__('List Dances'), array('action' =&gt; 'index')); ?&gt;&lt;/li&gt;
          &lt;li&gt;&lt;?php echo $this-&gt;Html-&gt;link(__('List Dancers'), array('controller' =&gt; 'dancers', 'action' =&gt; 'index')); ?&gt; &lt;/li&gt;
          &lt;li&gt;&lt;?php echo $this-&gt;Html-&gt;link(__('New Dancers'), array('controller' =&gt; 'dancers', 'action' =&gt; 'add')); ?&gt; &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I think the relevant tables would be:
  dancers,
  dancers_dances,
  dances</p>
  
  <p>On the dancers_dances table I have the following columns:
  id,
  dancer_id,
  dance_id</p>
  
  <p>Let me know if more info would be helpful.</p>
  
  <p>Thanks in advance.</p>