Yii Framework Forum: EDialog usage - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

EDialog usage Rate Topic: -----

#21 User is offline   kalmenchia 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 02-February 09

Posted 27 June 2009 - 03:45 AM

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.
0

#22 User is offline   yoshi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 170
  • Joined: 28-February 09
  • Location:Germany

Posted 28 June 2009 - 04:11 PM

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
0

#23 User is offline   kalmenchia 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 02-February 09

Posted 28 June 2009 - 07:23 PM

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,

0

#24 User is offline   yoshi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 170
  • Joined: 28-February 09
  • Location:Germany

Posted 29 June 2009 - 03:02 AM

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


0

#25 User is offline   kalmenchia 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 02-February 09

Posted 29 June 2009 - 07:29 AM

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. :)
0

#26 User is offline   yoshi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 170
  • Joined: 28-February 09
  • Location:Germany

Posted 29 June 2009 - 11:50 AM

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
0

#27 User is offline   kalmenchia 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 02-February 09

Posted 29 June 2009 - 05:57 PM

Hi Yoshi ,


Thank you very much , it works now.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users