A Simple Dialog Box

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 class opens a jquery-based popup containing an action inside. No specific codding for dialog box needed, the usage is very simple.

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, [color="#0000ff"]when user press ‘Finish’ buttton then the dialog box is automatically closed and its return value is passed into the zipcode input box[/color].



[b]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.[color="#0000ff"] if your actions runs directly from your navigator then it runs too into the dialog box[/color].



this piece of code must be used to open the popup, the createDialogBox call creates a css-styled icon ready and configured to launch the jquery dialogbox.

<div id='dialogBoxLaunchIconPosition' style="margin-top: 10px;">

To start testing this dialog box sample, click this icon:

<?php DialogBox::createDialogBox(



   ,"Type your name:"







When dialog is finished then your input will be shown in this Input element:<br/>

<input id='testinput'></input>


CLOSING AND RETURN, the code for the action response to return the dialog value is as follows:

	public function actionSample()


    	$model=new SampleModel;






            	// form inputs are valid, do something here





    	$this->layout = "dialoglayout";



This was very useful, … great work, thank you for sharing, Ad

How to save from this form???