Hello
Yii 1.1.14
I’m trying to make a popup to select a year and then get some reporting output for the selected year :
The popup is generated by CJuiDialog. Inside CJuiDialog’, I have a form.
In the first time I had a normal submit button on the form and it worked fine.
But it did not close the popup.
Then I found this post : Yii - CJuiDialog Close on submit button click
The button of the dialog to submit the form closes the dialog but seems not to post to the indicated url.
I also tried ajaxSubmitButton() directly in the form.
Same result : Nothing happens when I click on the button.
There are no JS errors, nothing in the application log.
This is my View :
<div class="reporting">
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'mydialog',
'options'=>array(
'title'=>'select year test',
'autoOpen'=>false,
'modal'=>true,
'buttons' => array(
'Dialog Submit Button'=>'js:function(){
$.post(
$("#select-year-form").attr("action"),
$("#select-year-form").serialize(),
function(){$("#mydialog").dialog("close");}
);
}',
array('text'=>Yii::t('app','reporting.select.close'),'click'=> 'js:function(){$(this).dialog("close");}'),
),
),
));
?>
<div class="well">
<?php echo CHtml::beginForm(CHtml::normalizeUrl(array('/site/about')),'post',array('id'=>'select-year-form')); ?>
<table class="contentheader">
<tr>
<td><?php echo CHtml::DropDownList('year', $lastyear, $yearslist, array('options'=>array($lastyear=>array('selected'=>true)) )); ?></td>
</tr>
</table>
<br />
<?php echo CHtml::ajaxSubmitButton('Form Ajax Submit Button',
CHtml::normalizeUrl(array('/site/about')),
array('success'=>'function(){$("#mydialog").dialog("close");}'),
array('name' => 'run', 'class' => 'btn btn-success')
); ?>
<?php echo CHtml::endForm(); ?>
</div>
<?php
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::link(Yii::t('app','app.menu.reporting.planning.xlsabsence'), '#', array(
'onclick'=>'$("#mydialog").dialog("open"); return false;',
));
?>
</div>
It would be nice if someone could help me find out what the problem is !