Model Is Not Set (Actioncreate)

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');

It doesn’t work :(

same problem here

so i have passed two models in actionCreate()

$form->textFieldRow($model2,‘name’);

and it works fine !!!

Here is my full actual code, if anyone could look at this…Thanks

http://pastebin.com/MuESVWsQ

did You pass $commune to the form ?

show how You render _form in your view.