php - Form made in Yii returns error, Property is not defined -


i have controller ecommercecontroller.php , looks this:

public function actionlegalisation()     {         $model = new product();  $this->render('legalisation', array('model'=>$model, 'documents'=>$documents, 'countriesissued'=>$countriesissued, 'countries'=>$countries, 'flag'=>$flag));     } 

and in legalisation view have:

<?php $form=$this->beginwidget('cactiveform', array(     'id'=>'legalisationform',     'action' => $this->createurl($this->id."/".$this->action->id),     'enableajaxvalidation'=>true,     'clientoptions' => array(   'validateonsubmit'=>true,   'validateonchange'=>true,   'validateontype'=>false,      ), )); ?>     <table>         <tr>             <td>                 <?php echo $form->dropdownlist($model, 'countriesissued', $select = array($_post['countriesissued'])); ?>             </td>         </tr>     </table> 

this code return me cexeption property "product.countriesissued" not defined.

when of using chtml , got dropdown list full countries name, this:

<?php echo chtml::dropdownlist($form, 'countriesissued', $select = array($_post['countriesissued']),                   chtml::listdata($countriesissued, 'code', 'name')); ?> 

i need dropdown list field values (countries) can me? thanks.

this bellow code give assistance overcome error facing.

wring in controller

    $criteria = new cdbcriteria;     $criteria->order = 'country_name asc';     $locations = countries::model()->findall($criteria);     $dataary['countries'] = chtml::listdata($locations, 'id', 'country_name');     $this->render('index', $dataary); 

write in form

    echo $form->dropdownlist($model, 'attribute', $countries, array('prompt' => 'select country'));     echo $form->error($model, 'attribute'); 

for more information please visit http://www.yiiframework.com/forum/index.php/topic/9693-cactiveform-dropdownlist-selectedselected/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -