Tilak Tilak - 4 months ago 18
PHP Question

include(MultiModelForm.php): failed to open stream: No such file or directory

<?php
if(!isset($data)) {$data=array(); };
$this->widget('ext.multimodelform.MultiModelForm',array(
'id' => 'id_ssc_affliations', //the unique widget id
'formConfig' => $myFormConfig, //the form configuration array
'model' => $model, //instance of the form model
'tableView'=>true,
'data'=>$data,
'bootstrapLayout'=>true,
'addItemAsButton'=>true,
'jsAfterNewId'=>MultiModelForm::afterNewIdDateTimePicker($myFormConfig['elements']),

//if submitted not empty from the controller,
//the form will be rendered with validation errors
//'validatedItems' => $validatedMembers,

//array of member instances loaded from db
//'data' => $member->findAll('groupid=:groupId', array(':groupId'=>$model->id)),
));
?>


I'm getting this error please help me

Error 500
include(MultiModelForm.php): failed to open stream: No such file or directory

Answer

Add

Yii::import('ext.multimodelform.MultiModelForm'); 

at the top of this file.

I assume $this->widget() implicitly imports the MultiModelForm class too.

The problem is that you pass MultiModelForm::afterNewIdDateTimePicker($myFormConfig['elements']) as an argument to it. So your app should know the class MultiModelForm in advance before calling the widget() function. Adding explicit import at the top should solve this problem.

Comments