Yii Framework Forum: simple dialog box feature for Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

simple dialog box feature for Yii simple dialog box use, sample application available here Rate Topic: ***** 1 Votes

#1 User is offline   bluyell 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 28-October 11

Posted 04 November 2011 - 10:58 PM

hello everyone, i build a dialog box feature that may be usefull for everyone using yii framework.
Only one component is requiered: DialogBox.php and no more.
The dialogbox opens a jquery-based popup with an action inside. No specific codding for dialog box needed.

hope it will be usefull..


a screen shot, showing you how it looks like, the 'zipcode' labeled input element receive the dialog output when it is finished. the dialog runs an action as content body, when user press 'Finish' buttton then the dialog box is automatically closed and its return value is passed into the zipcode input box.


please note that the entire dialog content (including control buttons) is a standard Yii action (running inside a iframe), not special codding needed for dialog. if your actions runs directly from your navigator then it runs too into the dialog box.

Posted Image

sample view:

<div id='dialogBoxLaunchIconPosition' style="margin-top: 10px;">
To start testing this dialog box sample, click this icon:
<?php DialogBox::createDialogBox(
    $this
   ,"myDialog1"
   ,"Type your name:"
   ,"site/sample"
   ,"testinput"
   ,"sampleIconCssStyle"
   ,320,300
 ); 
?>


When dialog is finished then your input is shown here:<br/>
<input id='testinput'></input>

 </div>



the code for the action response to return the dialog value is as follows:

	public function actionSample()
	{
    	$model=new SampleModel;
    	if(isset($_POST['SampleModel']))
    	{
        	$model->attributes=$_POST['SampleModel'];
        	if($model->validate())
        	{
            	// form inputs are valid, do something here
            	DialogBox::closeDialogBox($model->name,"index.php?r=site/sample");
            	return;
        	}
    	}
    	$this->layout = "dialoglayout";
    	$this->render('sample',array('model'=>$model));
	}	




Attached File(s)


1

Share this topic:


Page 1 of 1
  • 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