Jump to content
Larry Ullman's Book Forums

Yii Widgets And Yii Booster Widgets

Recommended Posts

Has anyone else experienced situations where widgets made for Yii don't work with dynamic data. A few times now i have started to make customizations on widgets and found in the end they are off no use and the situations need to be harded coded and customized for our own solution.


Ooohhhh! I have shot myself in the foot this time. I found a work around! :(

Link to post
Share on other sites
  • 2 months later...

Hi ,


I am facing problem managing dynamic widgets too.


The widget is as given below ,

class SiteWidget extends CWidget
    public $siteId;
    public $model;

    public function run()
        $this->model= new Site();

    function loadSite()
        if($this->siteId != null)
                      $this->model = Site::model()->find('id=:id',array(':id'=>$this->siteId));

The widget view 'SiteTab' contains the code shown below

<div class="form">
    <?php echo CHtml::beginForm(); ?>

        $form = $this->beginWidget('CActiveForm', array(
    <div class="div_body_content">
        <?php echo $form->textField($model,'Site_Name',..)?>
        <?php echo form->textField($model,'Site_Imp',..); ?>
    <?php $this->endWidget(); ?>
    <?php echo CHtml::endForm(); ?>

When a user enters the value for the first text field , this value has to be passed back to the widget , and the remaining fields in the widget have to be populated.



Please help me in achieveing this.



Link to post
Share on other sites

I am not clear of what you are doing here, are you creating your own widget? What is a Site model? What is the function of your forum with two text inputs? What are the vales supposed to be, why and what are you populating the remaining text input with?


(Regarding this post 'I love the Yii widgets, it was all my fault things went wrong before, i love the them almost as much as my love for Larry himself'. Sorry for my negative attitude regarding widgets before, its all positive now.


If you have any questions on how to do things with the CGridView, CDetailView etc Edward is the person to ask. If you have any questions bring them on, i would love to express my love from them in helping you.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...