tzoll
(T Zolciak)
March 17, 2013, 4:26pm
1
Hello. I have 3 database tables:
tbl_city(id,name,commune_id)
tbl_comune(id,name)
tbl_observation(id, name, city_id)
I’ve 3 models too and defined relations:
City('idCommune' => array(self::BELONGS_TO, 'Commune', 'commune_id'),
Commune(without defined relations)
Observation('idCity' => array(self::BELONGS_TO, 'City', 'city_id').
In my _form view i’ve got this textFieldRow:
$form->textFieldRow($model->idCity->idCommune,'name');?>
When i try to edit my observation everything works fine, but when i try to create new observatoins i’ve got this error:
TbInput: Failed to initialize widget! Model is not set.
I think that this error is caused, because when i try to create a new observation my _form view try to load Commune name, but it’s empty. Can you help me with this?
Sorry for my english
Thanks.
Greetings
Tom
satan666
(Nirmal9847)
March 19, 2013, 8:02am
2
tzoll:
Hello. I have 3 database tables:
tbl_city(id,name,commune_id)
tbl_comune(id,name)
tbl_observation(id, name, city_id)
I’ve 3 models too and defined relations:
City('idCommune' => array(self::BELONGS_TO, 'Commune', 'commune_id'),
Commune(without defined relations)
Observation('idCity' => array(self::BELONGS_TO, 'City', 'city_id').
In my _form view i’ve got this textFieldRow:
$form->textFieldRow($model->idCity->idCommune,'name');?>
When i try to edit my observation everything works fine, but when i try to create new observatoins i’ve got this error:
TbInput: Failed to initialize widget! Model is not set.
I think that this error is caused, because when i try to create a new observation my _form view try to load Commune name, but it’s empty. Can you help me with this?
Sorry for my english
Thanks.
Greetings
Tom
$form->textFieldRow($myCommuneModelName,'name');
lalzada
(Lalzadamohmand)
March 19, 2013, 11:06am
4
same problem here
so i have passed two models in actionCreate()
$form->textFieldRow($model2,‘name’);
and it works fine !!!
tzoll
(T Zolciak)
March 19, 2013, 11:34am
5
Here is my full actual code, if anyone could look at this…Thanks
http://pastebin.com/MuESVWsQ
mirunho
(D Mirecki)
March 19, 2013, 1:26pm
6
did You pass $commune to the form ?
show how You render _form in your view.