[Solved] Get The Id Of The Current Dropdowllist

Hi.

I have a generated dropdowlist in a loop. and I want to get the ID of this dropdown when I select a value.

so : My dropdown :


echo $form->dropDownList($eventForm, 'nbSession',

		array(

			1=>'1',

			2=>'2',

			3=>'3',

			4=>'4',

			5=>'5'

		),

		array(

		'prompt' => 'Choisissez le nombre de session d\'ateliers',

		'id' => $i,

		'class'=>'eventForm',

		'ajax' => array(

		'type' => 'POST',

		'url' => @Yii::app()->createUrl('admin/UpdateAjaxFormNbSession'),

		'data' => array('form'=>serialize($form), 'listAteliers'=>$listAteliers, 'nbSession'=>'js:this.value'),

		'update' => '#session'

),)); 

so, I want to get the ID of the dropdown when I select a value to update de right div. So I tried :

‘update’ => ‘js:this.id’ but it take the string and don’t execute the Javascript.

or :

‘update’ => $this->ID but it gives “admin”(my session I guess)

so what Can I write to have the ID of my dropdownlist? thx.

refresh to have an answer. I edited my post whith my new elements to be clear.

Hi,

Dont keep your component id like this… its bettter to use model id with dropdown… example

if my model has id field … it has value 100… i would like to create id as

‘id’ =>‘dropdown’.$model->id

then you can get the id easily :)

I hope it will help you to solve your problem

Thanks.

Yes i think about that. the problem is that it didn’t have already the ID because, it’s a form to add an element who have an auto increment ID. So I don’t care about ID of my model to create it in my DB :P

But I found a solution.

I gives the ID of my drop down with my several loop. ( ‘id’ => ‘dropDownAtelier’.$numJour.$numSession.$numActivity)

then, they have different ID and it works.

thx. it’s solved :)