$fa=EmployerJobs::model()->findAll();
$model = new EmployerJobs();
$list = CHtml::listData($fa,'Employer_JobsJobCode','Employer_JobsJobCode');
echo CHtml::activeDropDownList($model,'Employer_JobsJobCode',$list, array('empty' => 'Please Select'
, 'id'=> 'shrtlst_candt_jobcode',
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('Jobaspirant/shortlistCan'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#shrtlst_candt-firstname2', //selector to update
'data'=>"javascript:$('#shrtlst_candt_jobcode option:selected').val();"
//leave out the data key to pass all form values through
)));
?>
it’s working fine, select making a list of values from table called employerjobs,
This is my controller
public function actionShortlistCan()
{
$model = new Candidateinterview;
$new_interviews = Candidateinterview::model()->findAllByAttributes(array('AspirantID'=>$model->AspirantID,'ConfirmInterview'=>0));
$model = new EmployerJobs;
$data = EmployerJobs::model()->findAll();
/*'Employer_JobsJobCode',
array($_POST['Employer_JobsJobCode'])*/
$data=CHtml::listData($data,'Employer_JobsJobPos','Employer_JobsJobLoc');
foreach($data as $value=>$name)
{
echo CHtml::tag('h3',
array('value'=>$value),CHtml::encode($name),true);
}
}
if i change value in dropdown it should retrive particular row details.
im newbie on yii, i confused, seeking for any help. TIA