Yii Framework Forum: tbactiveform issues moving to new yiibooster - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

tbactiveform issues moving to new yiibooster

#1 User is offline   Alexc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 11-March 15

Posted 30 October 2015 - 07:04 AM

Hi,

I recently was given a task to update our yiibooster extension.

The issue I'm having is that this tbform code no longer works in this version of yiibooster (the entire tbform functionality seems to have been removed)

 $sessionForm = new SessionSelectionForm();

         $items = $dataModel->getDynamicFormSessionsConfig($sessionForm);

//         $form = TbForm::createForm(
//                         array(
//                     'title' => 'Session Registration',
//                     'enableClientValidation' => true,
//                     'enableAjaxValidation' => false, // Just keep this to false
//                     'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL,
//                     'elements' => $items,
//                     'buttons' => array(
//                         'reset' => array(
//                             'type' => 'reset',
//                             'label' => 'Reset',
//                         ),
//                         'submit' => array(
//                             'type' => 'submit',
//                             'label' => 'Next',
//                             'layoutType' => 'primary'
//                         ),
// //                        'cancel' => array(
// //                            'type' => 'submit',
// //                            'label' => 'Cancel',
// //                            'layoutType' => 'warning'
// //                        ),
//                     ),
//                         ), null, array(
//                     'htmlOptions' => array('class' => 'well'),
//                     'type' => 'horizontal',
//                         ), $sessionForm
//         );
//         return $form;


My guess to rebuilding the functionality for this would be but I'm getting no luck in having it actually work. (tbactiveform.0 is not defined)


$sessionForm = new SessionSelectionForm();

         $items = $dataModel->getDynamicFormSessionsConfig($sessionForm);

$form = $this->beginWidget(
                    'booster.widgets.TbActiveForm',
                        array(
                            // 'title' => 'Session Registration',
                            'enableClientValidation' => true,
                            'enableAjaxValidation' => false, // Just keep this to false
                            // 'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL,
                            'htmlOptions' => array(
                                    'type' => 'horizontal',
                                    'data' => $items,
                                    ),
                                    null,  $sessionForm
                            )
                        );                                          // 'elements' => $items,
                        $this->widget(
                             'booster.widgets.TbButtonGroup',
                                array(
                                    'buttons' => array(
                                        array('label' => 'reset', 'buttonType' => 'reset'),
                                        array('label' => 'next', 'buttonType' => 'submit'),
                                    ),
                                )                
                        );
            $this->endWidget();
            return $form;

0

#2 User is offline   Alexc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 11-March 15

Posted 30 October 2015 - 11:58 AM

Began to fix it by changing code to $form = new TbForm

and adding this class to my controller.

class SessionSelectionForm extends CFormModel
 {
   public $text;
   public $hidden;
   public $password;
   public $textarea;
   public $file;
   public $radio;
   public $checkbox;
   public $listbox;
   public $dropdownlist;
   public $checkboxlist;
   public $radiolist;
   public $url;
   public $email;
   public $number;
   public $range;
   public $date;
   public $time;
   public $tel;
   public $search;
   public $toggle;
   public $datepicker;
   public $daterange;
   public $timepicker;
   public $datetimepicker;
   public $select2;
   public $redactor;
   public $html5editor;
   public $markdowneditor;
   public $ckeditor;
   public $typeahead;
   public $maskedtext;
    public $colorpicker;
   //public $captcha;
   public $pass;

   public function rules()
   {
       return array(
           array(
               'text,hidden,password,textarea,file,radio,checkbox,listbox,dropdownlist,checkboxlist,radiolist,url'
               .',email,number,range,date,time,tel,search,toggle,datepicker,daterange,timepicker,datetimepicker'
               .',select2,redactor,html5editor,markdowneditor,ckeditor,typeahead,maskedtext,colorpicker,pass','safe'
           )
      );
  }
}


I'm still getting this error though

Fatal error: Call to a member function beginWidget() on array in /Applications/XAMPP/xamppfiles/htdocs/framework/web/form/CForm.php on line 437
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users