I tried to use $form=$this->beginWidget(‘CActiveForm’); in a CPortlet class but than when I placed it in one of my layouts as $this->widget(‘application.components.Email’); I got the following error:
CException
Description
CActiveForm has an extra endWidget() call in its view.
Source File
/home/localhost/framework113r2247/web/CBaseController.php(203)
00191: * @return CWidget the widget just ended running
00192: * @throws CException if an extra endWidget call is made
00193: * @see beginWidget
00194: */
00195: public function endWidget($id='')
00196: {
00197: if(($widget=array_pop($this->_widgetStack))!==null)
00198: {
00199: $widget->run();
00200: return $widget;
00201: }
00202: else
00203: throw new CException(Yii::t('yii','{controller} has an extra endWidget({id}) call in its view.',
00204: array('{controller}'=>get_class($this),'{id}'=>$id)));
00205: }
00206:
00207: /**
00208: * Begins recording a clip.
00209: * This method is a shortcut to beginning {@link CClipWidget}.
00210: * @param string the clip ID.
00211: * @param array initial property values for {@link CClipWidget}.
00212: */
00213: public function beginClip($id,$properties=array())
00214: {
00215: $properties['id']=$id;
replacing the CActiveForm with the usual CHtml::beginFrom()…etc fixed the issue but now I am unable to use the handy ajax validation feature of the CActiveFrom widget.
I suffered the same by a human error (in the middle of a system change from Linux to Windows, where some day before). It’s unintentionally deleting the php tag in a opening tag of a line <?php.
Wrong code without php in the first open tag, like <?