Form gönderilirken Portletin içinde bir yöntemi çağırma

1 Cevap php

Ben bir form içeren bir Portletini var. Şimdi ne elde etmek istediğiniz şudur.

1) bir form içeren bir Porlet üzeri sayfa içinde denir

<?php $this->widget('form'); ?>

2) The user fills in this form and clicks on submit "The submit button should be an ajax button" 3) When submit has been pressed the form should call a method within the form portlet class and the form should be replaced with a Thank you message. 4) I only want the current view in the portlet replaced with another view.

Benim portlet sınıfı bu gibi görünüyor

Yii::import('zii.widgets.CPortlet');

class Polls extends CPortlet{

    public $usr_id=''; 


    public function init(){

        $cs = Yii::app()->clientScript;
        $cs->registerCoreScript('jquery');
        parent::init();
    }

    protected function renderContent(){    
        $this->render('form');
    }

    public function update(){
       $this->render('thankyou');
    }
}

}

1 Cevap

Ben portlet kendisi URL yoluyla ulaşılamazsa, sadece yana portletle bunu yapamam korkuyorum. Böyle bir vekil denetleyicisi eylem oluşturmak zorunda:

ProxyController extends CController {
  function actionPortlet(){
    $portlet = new Polls();
    $portlet->usr_id = 123;
    $portlet->update();
  }
}