CJuiDialog buttons

This line works fine for me in a wiew :rolleyes: .


$this->createUrl('my_module/my_view')

But I need to use that line in a cJuiDialog button, but can-t get it to work. cJuiDialog use this structure:


'buttons' => array

(

     'Ok'=>'js:function(){alert("ok")}',

     'Cancel'=>'js:function(){alert("cancel")}',

),

Well, I’m a newbie here, and i thing I have the grammar wrong cause this doesn’t work


'Ok'=>'$this->createUrl('my_module/my_view')',

So I’m stuck here, maybe is something simple, but is hidden for me ??? !! Some help please !!

Hey,

I faced this problem before and had to find a workaround, since i could find a way to trigger an action from the CJuiDialog buttons. Instead of doing what you stated, why don’t you add a button inside the dialog? It is not the most elegant solution, in case you find one pls let me know! :) Hope this is helpful




<?php

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

    'id' => 'window',

    'options' => array(

        'title' => 'My Custom Dialog',

        'autoOpen' => false,

    ),

));

?>

// Here you add the button to the dialog instead of using CJuiDialogs options

<div class="row buttons">

    <?php echo CHtml::ajaxSubmitButton('buttonSubmit'), CHtml::normalizeUrl(array('my_module/my_view', 'render' => false)), array('update' => 'js: function() {..}')); ?>

</div>

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

Hello Sofia, thanks for the reply

Well, I could not find the solution.

I did the same whit a button inside the dialog, just modified the css to style that button in order to maintain the design.

But I still have this doubt on my mind, If I figure it out i will tell you. ::)