public function actionAjaxUpdateSegmentGrid() {
$pid = Yii::app()->getRequest()->getParam('pid');
$dataProviderExistingSegments=new CActiveDataProvider('LoadProfileSegment', array(
'criteria'=>array(
'condition'=>'ProfileID=' . $pid,
'order'=>'SegmentNo',
),));
$this->renderPartial('_segmentGrid',array(
'dataProviderExistingSegments'=>$dataProviderExistingSegments,
));
}
The partial _segmentGrid contains the gridview widget only. This all works fine.
My question is…is it possible to do the same or a similar thing with a CActiveForm. I have the form widget in a partial just as the grid is and would like to be able to make an ajax call from javascript so that the form model is ‘refreshed’ and populated with new values from this model.
thanks zaccaria…in the end I solved it with a new controller function
public function actionAjaxClearSegmentForm() {
$modelProfileSegment = new LoadProfileSegment;
$this->renderPartial('_segmentForm',array(
'modelProfileSegment'=>$modelProfileSegment,
));
}
and the following js call (using jq ui dialog directly)
hi…I intend that the form will have ajax validation so that as focus moves from a field it will be checked against the model rules. I have not put this in yet but have another form which does that and it seems to work okay, proper testing to be done and validation to be added in today! That should ensure that the input is correct. I will take a closer look at your wiki though as I was unaware of the CJuiDialog class - I am used to using jQ UI dialog directly and am interested to see how the wrapper works and what advantages it offers.