CJuiAutoComplete

hi all,

i’m new to yii and i am currently stuck on an issue that I am hoping someone can help me out with.

i have a function in protected/controller/siswaController:




public function actionDynamic(){

    $data=Users::model()->findAll();

    $dataUser=array();

    foreach($data as $users);

    $dataUser[]=$users->username;

    endforeach;

    $this->render('_form',array(

	'dataProvider'=>$dataUser,

			));

			

	}



and this is in my protected/views/siswa/_form:




<?php 

	$this->widget('zii.widgets.jui.CJuiAutoComplete',array(

		'name'=>'username',

		'source'=>$dataProvider,

		'options'=>array(

			'minLength'=>'0',

		),

		));

		?>




and i get an error: Undefined variable: dataProvider

Can you please help me with that?

Thanks a lot

not sure if it’s a typing mistake but you seem to have few typo/bugs there…

  • your foreach is terminated with ";" instead with ":"…

  • in the controller you are rendering "_form"… but you show the source of "form" (without the underscore)

yup, i don’t see it, hehe

i just fix it, but i still have the same error

actually, it’s located in protected/views/siswa/_form.php

sorry, i forget to write the underscore

So now that typos are fixed…

Check that in your controller on the render call you use proper case for "dataProvider" instead of (for example) "dataprovider"

I don’t see anything else that could be wrong.