Cjuidialog In For Loop

Hello ,

I have a for loop in which I am printing content in table.

In last <td> I am giving button on which I am using CJuiDialog to open a Dialog box and take actions on it.

But if loop continues for more than 1 times,

then it is CJuiDialog is fail.

code for view is as below:




for ($index=0;$index < $array_size ;$index++)

			{

				echo "<tr>";

				for ($inner_index=0;$inner_index < 6 ;$inner_index=$inner_index+6)

				{

					$sr_no=$index+1;

					echo "<td>".$sr_no."</td>";

					echo "<td>".$skillTypeName."</td>";

					echo "<td>".$skill."</td>";

					if($update_id==0)

						{

// HERE IS MAIN

echo "<td>".CHtml::button('View',array('id'=>'view','onclick'=>'$("#dialog_box").dialog("open");'),array('submit' => array('CONTROLLER/ACTION', 'skill_id'=>$skills_id,)));


echo CHtml::button('Edit',array('id'=>'edit','onclick'=>'$("#dialog_box2").dialog("open");'),array('submit' => array('CONTROLLER/ACTION', 'skill_id'=>$skills_id,)))."</td>";

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

												'id'=>'dialog_box',

													'options'=>array(

													'title'=>'Skill',

													'autoOpen'=>false,

//													'style'=>'width:560px;min-height:100px;hight:365px;',

													),

												));


echo $this->renderPartial('_status_change', array('model'=>'','skillTypeName'=>$skillTypeName,'skill'=>$skill,'practice'=>$skills_1[$index]['practice'],'project'=>$skills_1[$index]['project'],'last_used'=>$date_last_use,'desc'=>$skills_1[$index]['skill_desc']));

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

						}

					else

						echo "<td>"."Approved"."</td>";

					

				}






but if loop continues for more than 1 time,

then it shows me applicable content for "for loop" in "_status_change.php" file.

what is wrong here?

Is there any Return False concept here,

which I am missing?

It looks like you are generating a JuiDialog in each loop. ID has to be different for every one. Check the output in the browse if the JuiDialog ID is the same, if it is that will confuse the show() script.

Maybe instead generate the link/button in the grid, then one JuiDialog at the end of the page.

Thanks a lot!

I got it.

I changed id:)