Model 在cakephp中将验证添加到多个选择列表框

Model 在cakephp中将验证添加到多个选择列表框,model,Model,您好,我已经在helper中创建了创建表单的函数。这是我的函数 function createAlbumForm1($controller, $actionUrl, $dialogTitle, $dialogId, $bandId ) { // echo "hello"; $songlist=$this->requestAction('/Albums/index'); //$comma_separated = implode(",", $songlist);

您好,我已经在helper中创建了创建表单的函数。这是我的函数

function createAlbumForm1($controller, $actionUrl, $dialogTitle, $dialogId, $bandId ) {
      // echo "hello";
     $songlist=$this->requestAction('/Albums/index');
     //$comma_separated = implode(",", $songlist);
      $options = array( $songlist);
      $selected = array('3');
      $albumlist=$this->requestAction('/Albums/view1');
     //print_r($songlist);
        $uploadForm =
        $this->Form->create($controller, array('action' => $actionUrl
                , 'enctype' => 'multipart/form-data'
                , 'type' => '')) .
            '<fieldset>' .
              $this->Form->input('id',array('label' => 'Albums', 'type' => 'select', 'options' =>$albumlist)).
          $this->Form->input('song_id',array('label' => 'Songs to add',  'options' =>$songlist,'multiple'=>'true','style' =>'width:170px;height:150px;')).



          $this->Form->input('band_id', array('type' => 'hidden', 'value' => $bandId)) .

            $this->Form->input('ADD'
                , array('style' => 'width:80px; float: right;'
                , 'type' => 'submit', 'label' => false)) .
            '</fieldset>' .
            $this->Form->end();
            return $uploadForm;

    }
您能否告诉我如何添加验证,就像用户一次可以选择3个ITME一样 从多个选择列表框中

class Album extends AppModel {

    var $name = 'Album';


    function beforeValidate($options = array())
     {

       if(!empty($this->data['Album']['song_id']))
       {
            $this->data['Album']['song_id'] = join(',', $this->data['Album']['song_id']);
       }

     }
          var $validate = array(
            'song_id' => array(
            'rule' => array('multiple', array('max' => 3)),
            'message' => 'You have to choose at least one category'
        )
    );


}