Send data from a Controller to CJuiDialog

Hi!

How can I send a value from a bucle to a CJuiDialog? This is my code now:




<h1>Users</h1>


<?php foreach($users as $user): ?>

 <div class="item-user">				

				<div class="nombre">		

					<p><?php echo $user->nombre ?></p>					

				</div>

				<div class="email">					

					<p><?php echo $user->email ?></p>					

				</div>				

				<div class="actions">				

					<?php echo CHtml::link('DELETE', 'delete/id/'.$user->id_user, array(

					   'onclick'=>'$("#mydialog").dialog("open"); return false;',

					   'class'=>'delete', 

					)); ?>									

				</div>

	</div>

<?php endforeach;?> 


<?php  

$this->beginWidget('zii.widgets.jui.CJuiDialog', array(

    'id'=>'mydialog',

    'options'=>array(

        'title'=>'Delete user',

        'autoOpen'=>false,

        'modal'=>true,        

            ),

)); ?>


<p>¿Are you sure?</p>	

<a href="delete/id/<?php echo $user->id_user ?>" class="delete">


<?php $this->endWidget('zii.widgets.jui.CJuiDialog');



I want send the $id inside de bucle to CjuiDialog…(sorry for muy english)

Is what you have not working? And when you say $id you mean $user->id ?

Yes, the $user->id.

I want something like this:


<div class="actions">                           

        <?php echo CHtml::link('DELETE', 'delete/id/'.$user->id_user, array(

                           'onclick'=>'$("#mydialog").dialog("open"); $id=$user->id_user; return false;',

                           'class'=>'delete',

                          


 

       )); ?>                                                                  

</div>

But this is not the way of do it.

Look at: $id=$user->id_user;

You can try




<div class="actions">                           

    <?php echo CHtml::link('DELETE', 'delete/id/'.$user->id_user, array(

        'onclick'=>'$("#mydialog").data({ my_id: "'.$user->id_iser.'"; }).dialog("open"); 

             return false;',

        'class'=>'delete',

)); ?>                                                                  

</div>



Check this

and look for jquery data() function.