w-create-dialog-bootstrap-base creates a dialog box for forms using CJuiDialog for any controller

  1. Requirements
  2. Usage
  3. Resources

WCreateDialog displays a dialog widget with create form using the given controller path. We can now use any controller provided that we change the controller's create function as mentioned below. WCreateDialog extends the CJuiDialog widget.

It simplifies the dialog creation process using the guide from http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model/

It Reduces all the work and you just have to amend controller yourself.


...requirements of using this extension is Yii 1.1 or above ...This one depends upon bootstrap as it uses TbHtml Class a lot. You can either change the class to CHtml yourself or download the other extension


unpack the package to extension/webcare/widgets

To use this widget, you may insert the following code in a view:

$this->beginWidget('ext.webcare.widgets.WCreateDialog', array(// the dialog
     'id' => 'MyDialog',
     'linkText' => 'Create New MyClass', // The Button which is placed for opening the dialog
     'url' => array('controller/create'), // controller/action usually create
     'parentElementSelector' => '#selectElement',  // the parent select element in which the data returned will be populated
    // additional javascript options for the dialog plugin
        'title'=>'Dialog box 1',

Don't forget to change your controller's create action like the following

if ($model->save()) {
      if (Yii::app()->request->isAjaxRequest && Yii::app()->request->isPostRequest) {
          echo CJSON::encode(
                      'status' => 'success',
                      'div' => 'MyClass Record successfully added',
                      'newObj' => array('id'=>$model->id,'value'=>$model->title),
     } else {
         $this->redirect(array('view', 'id' => $model->id));

And before the following code

$this->render('create', array(
      'model' => $model,

Add the following

if (Yii::app()->request->isAjaxRequest) {
   echo CJSON::encode(array(
     'div'=>$this->renderPartial('_form', array('model'=>$model), true)));


0 0
1 follower
Yii Version: 1.1
License: PHP-3.0
Category: User Interface
Developed by: Rehan Anis
Created on: Mar 17, 2015
Last updated: 8 years ago


show all

Related Extensions