Problem With Cjuidialog


Yii 1.1.14

I’m creating an application, I want to get a popup to select a year and then generate a reporting file corresponding to this selected year.

To test things before I had a fixed variable for the year and it worked fine.

Now I tried to use CJuiDialog to ask for the year.

Here’s the controller action :

	public function actionReporting()


		$years = array();

		$yearstmp = Yii::app()->db->createCommand("SELECT DISTINCT year FROM {{planning}} ORDER BY year")->queryAll();

		foreach ($yearstmp as $yeartmp) {

			$years[$yeartmp['year']] = $yeartmp['year'];

			$lastyear = $yeartmp['year'];


		if(isset($_POST['run'])) {


		} else {









And this is the view :

<div class="reportingtest">


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


				array('label'=>Yii::t('app',''), 'url'=>array('/planning/xlsAbsences')),





<div class="reporting">










	<div class="well">

		<?php echo CHtml::beginForm('','post'); ?>

		<table class="contentheader">


				<th><?php echo Yii::t('app',''); ?></th>



				<td><?php echo CHtml::DropDownList('year', $lastyear, $years, array('options'=>array($lastyear=>array('selected'=>true)) )); ?></td>



		<br />

		<?php echo CHtml::submitButton('Run', array('name' => 'run', 'class' => 'btn btn-success')); ?>

		<?php echo CHtml::endForm(); ?>




		echo CHtml::link(Yii::t('app',''), '#', array(

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




But this does not work :

The old link in div reportingtest does not work anymore (page not found at …/index.php?r=planning/xlsAbsences).

But the action xlsAbsences exists and has not changed.

The new link in div reporting does not work better - same error.

And here’s the most weird thing :

If in the view, I delete the line : <?php echo CHtml::DropDownList …

The old link works again.

But perhaps this is normal but please I need to understand whats happening !?

EDIT : I updatede source code …


Please can you attach your screenshot of your requirement

Please can you try everything inside form… i saw two link outside form :)

It will better to understand your requirement when u attach your screenshot

Ok here’s the screenshot of the page :

First link is the old link which worked before (without the year)

Now if I click this one I get Page not found :

Second link is the new link that opens CJuiDialog

When clicking this one I get the Dialog :

I choose 2014 and click Run and so I get again this :


Did you check your request.?

Is it posting your values?

did u checked your log files?

Thanks - I found in application log the following :

2014/02/04 21:26:02 [error] [php] Invalid argument supplied for foreach() (C:\wamp\www\yii01\framework\web\helpers\CHtml.php:2325)

Stack trace:

#0 C:\wamp\www\yii01\framework\web\CBaseController.php(126): require()

#1 C:\wamp\www\yii01\framework\web\CBaseController.php(95): PlanningController->renderInternal()

#2 C:\wamp\www\yii01\framework\web\CController.php(869): PlanningController->renderFile()

#3 C:\wamp\www\yii01\framework\web\CController.php(782): PlanningController->renderPartial()

#4 C:\wamp\www\yii02\yiiars02\protected\controllers\PlanningController.php(632): PlanningController->render()

#5 C:\wamp\www\yii02\yiiars02\protected\controllers\PlanningController.php(318): PlanningController->actionXlsAbsences()

#6 C:\wamp\www\yii01\framework\web\actions\CInlineAction.php(49): PlanningController->actionReporting()

#7 C:\wamp\www\yii01\framework\web\CController.php(308): CInlineAction->runWithParams()

#8 C:\wamp\www\yii01\framework\web\filters\CFilterChain.php(133): PlanningController->runAction()

#9 C:\wamp\www\yii01\framework\web\filters\CFilter.php(40): CFilterChain->run()

#10 C:\wamp\www\yii01\framework\web\CController.php(1145): CAccessControlFilter->filter()

#11 C:\wamp\www\yii01\framework\web\filters\CInlineFilter.php(58): PlanningController->filterAccessControl()

#12 C:\wamp\www\yii01\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter()

#13 C:\wamp\www\yii01\framework\web\CController.php(291): CFilterChain->run()

#14 C:\wamp\www\yii01\framework\web\CController.php(265): PlanningController->runActionWithFilters()

#15 C:\wamp\www\yii01\framework\web\CWebApplication.php(282): PlanningController->run()

#16 C:\wamp\www\yii01\framework\web\CWebApplication.php(141): CWebApplication->runController()

#17 C:\wamp\www\yii01\framework\base\CApplication.php(180): CWebApplication->processRequest()

#18 C:\wamp\www\yii02\yiiars02\index.php(13): CWebApplication->run()


in C:\wamp\www\yii02\yiiars02\protected\views\planning\reporting.php (39)

in C:\wamp\www\yii02\yiiars02\protected\controllers\PlanningController.php (632)

in C:\wamp\www\yii02\yiiars02\protected\controllers\PlanningController.php (318)

I also have seen some errors in my code - I made the corrections and updated the source in my first post.

But the error is allways the same (and the log too) !

When I introduce a var_dump($listData) before line 2325 of CHtml.php I get :

array(2) { [2013]=> string(4) "2013" [2014]=> string(4) "2014" }

If I load the reporting page, add "var_dump($listData); exit;" before line 2325 of CHtml.php the process goes on without any error.

I do not understand what’s wrong with that !?

I worked on this problem for a while now.

If I do not make a call to another action of the same controler (as I tried to do actionReporting) all works fine.

I really need help here because I can’t understand why this call of another action is a problem - I had a look on other posts and I had the impression that this is the way to do.

I also wonder why the error appears only on application.log but no standard yii error page appears.

I found my error - I had a bad render instruction in the called action - not easy to find