Edit Cjuidialog Form From A Treeview In A Menu

Hi all,

I have a sidebar menu with a tree. With this tree, users have possibility to add new node entry clicking on "new entry" link, display at the end of each node. However, until there I displayed the update page of a generic node in order to create a new one. But displayed a new page is not very ergonomic and I would like to display the update form in a dialog box.

here the java script I use to create link on click (on my controller’s tree building function):

sprintf('<span>%s</span>',CHtml::link(($img." New entry"),"",array('onclick'=>"{updateElement(20,'".$this->createUrl('')."','treemenu-grid','#dialogTreemenu'); $('#dialogTreemenu').dialog('open');}")));

here is my dialog widget put in a content file

<?php  $this->beginWidget('zii.widgets.jui.CJuiDialog', array( // the dialog



        'title'=>'Create new entry',







<div class="divForForm"></div>


<?php $this->endWidget();?>

and here my javascript function called on click :

function updateElement(idvg,url,grid,box_name)




                if (data.status == 'failure')


                    $(box_name+' div.divForForm').html(data.div);

                          // Here is the trick: on submit-> once again this function!

                    $(box_name+' div.divForForm form').submit(updateElement);




                    $(box_name+' div.divForForm').html(data.div);

                    setTimeout("$('"+box_name+"').dialog('close') ",1000);





            } ,'cache':false});;

    return false;


The problem is, when I click on the link, my dialog opens but stays blank. Watching firebug gives me a “200 ok” on POST and the link called matches well with what is waited for. My javascript function is the same I use for my other grid and it works, but here for me tree, dialog stays blank and I don’t understand why…

Ok sorry for bothering, I found why it was not working, I had forgotten to change my custom function ActionCreateNewEntry in my controller as I did for other grids…

For those who are interested, explanations are here :