EDialog usage

Hi ,

I have a view form with EDialog in it and



$this->beginWidget('application.extensions.jui.EDialog',


   array(


      'name' => 'myDialog',


      'theme'=>'redmond',


      'compression'=>'none',


      'htmlOptions'=>array('title'=>'Hello dialog'),


      'options'=>array(


         'autoOpen'=>false,


         'show'=>'scale',     


         'bgiframe'=>true,


         'width'=>400,


         'modal'=>true, /* this makes the dialog, appear on a overlay */


      ),


      'buttons' => array(


         "Ok" => 'function(){$(this).dialog("close");}',


      )       


   )


);





//here is Qiang's sample code that I moved!


echo CHtml::form();


echo CHtml::textField('name');


echo CHtml::ajaxLink('submit', array('echo'), array(


   'type'=>'POST',


   'update'=>'#result',


));





//and changed a bit by echo ...


echo '</form>';


echo '<div id="result">';


echo 'Something have to be replace by actionEcho controller ...';


echo '</div>';





$this->endWidget('application.extensions.jui.EDialog');

And my actionEcho controller function code as :

        public function actionEcho()


        {


           if(Yii::app()->request->isAjaxRequest)


             {


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


                     if ($_POST['name'] !=''){


                         


                         echo "You entered: ".CHtml::encode($_POST['name']);


                     }


       }

From my code there , when I call the AjaxButton , it somehow did call to “actionEcho” and replace the text

"Something have to be replace by actionEcho controller …"

but it will always return with blank.

How can I achive by Ajax calling and then return the result into the DIALOG's  <div id= "myDialog"> Area and this is basically a popup search dialog  ?

Please advise , Thanks.

Hi kalmenchia,

beside the fact that there are two closing braces } missing in your posted controller code, it works well and alters the div "result" with the ajax response…

Maybe the issue is somewhere else?!

Greets

Hi Yoshi ,

thanks for trying to help , for my same code , if i move those code



//here is Qiang's sample code that I moved!


echo CHtml::form();


echo CHtml::textField('name');


echo CHtml::ajaxLink('submit', array('echo'), array(


   'type'=>'POST',


   'update'=>'#result',


));





//and changed a bit by echo ...


echo '</form>';


echo '<div id="result">';


echo 'Something have to be replace by actionEcho controller ...';


echo '</div>';


from within

$this->beginWidget('application.extensions.jui.EDialog',


...


...


$this->endWidget('application.extensions.jui.EDialog');


to before the $this->beginWidget('application.extensions.jui.EDialog',…

it works fine, when it move into the EDialog area , the ajax response only

display blank , so is it something wrong with the EDialog from Jui then ?

Thanks,

Hi kalmenchia ,

check your code that there is no other element (div, span, etc.) with the id "result" in your page.

Otherwise post the javascript part of your generated website or you can send me the hole source code of the generated webpage and i'll have a look at it…

Greets

Hi ,

I am very grateful and appreciate u take time to help .

I have checked my code there is no other element which id is "result" ,

pls do take note that it works if the code put outside the EDialog defination.

So I send my code here . http://comsoft.looki…d/Audit_His.zip .

there is an sql in the root folder . the zip file included the whole source code with jui that i used as well .

Thanks. :)

Ahhh… i see.

You are using nested forms which isn't allowed in html!

Just cut out the complete dialog code

<?php


// the script which opens the dialog, when the link is clicked


$script = "$('#openDialog').click(function(){$('#myDialog').dialog('open');});";





// here we add the script to the document ready function


$cs = Yii::app()->getClientScript();


$cs->registerScript('openDialog', $script, CClientScript::POS_READY);





// and now we create the EDialog widget with option:"autoOpen" set to false


// and a effect which is triggered when the dialog shows up...


$this->beginWidget('application.extensions.jui.EDialog',


   ....


$this->endWidget('application.extensions.jui.EDialog');


?>

and place it above the begin form statement

<?php echo CHtml::beginForm(); ?>
and everythings fine and working!  ;)

Greets,

yoshi

Hi Yoshi ,

Thank you very much , it works now.