php - YiiBooster Select2Row Data/Tag Issues -


so i've been trying select2row work me forever , can't seem hang of it. i'm trying provide user tags list school/university name, while @ same time storing value of said tag when save form. i've noticed cannot use both data , tags, else drop down wont populate that's not option. tags seem want text, rather text , matching values. ideas?

<div class="row">     <?php          echo $form->select2row($model, 'school_id', array(             'asdropdownlist'=>false,             'options'=>array(                 'tags'=>school::model()->schoolnames,                 //'maximumselectionsize'=>1,                 'width'=>'297px',                 'tokenseparators'=>array(','),             ),         ));      ?>     <?php echo $form->error($model,'school_id'); ?> </div> 

and here function schoolnames

public function getschoolnames() {     $schools = array();     $result = $this->findallbysql("select distinct name school");      foreach($result $school){         $schools[] = $school->name;     }        return $schools; } 

i've tried using instead, tags won't populate

public function getschools() {     $query = "select id,name school";     $results = $this->findallbysql($query);      return chtml::listdata($results, 'id', 'name'); } 

so @ moment, select2row generating list of tags using getschoolnames() , works fine, except once submit form using tags you'll this
please fix following input errors: school must integer.

sorry trouble, i'm still little new this. i'm sure answer right in front of me. either way =)

try this:

echo $form1->select2row($model, 'school_id', array(    'data' => school::model()->schoolnames,    'multiple' => 'multiple',    'options' => array(        "width" => '70%',    ), )); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -