extra fields in form which are not in db

my issue is i am having company,users tables.I will enter id,pwd in company form and it will store in users table.but company table will not contain pwd feild.Now when i write pwd field explicitly in company form it showing error like "Property "Company.pwd" is not defined".

How can i add fields in a form which are not in db

*** Note ***

@Roopa please pay attention to post in the right sub-forum

this is the second one you post in Yii-powered application and is not related to that…

Thread moved to Genera Discussion for Yii 1.1.x

I guess is in your form… use the following:

echo CHtml::passwordField(‘pwd’,‘INITITAL_VALUE_IF_YOU_PUT_ANY’);

And then on the controller you can get the posted value as simple as this:

$pwd = Yii::app()->request->getParam(‘pwd’);


If you look in CHtml class, you will see that there is a bunch of methods that you can use with or without model classes.


Hope I helped somehow…

Actually my issue is adding an extra field which is not in that particular model,i f write an extra field,then click on ‘create company’ then only it is showing error,if it is after entering details in company form i can manage,but before only it is showing,in public function __get($name) it is not accepting

I am actually using the same approach in my current application and it works perfectly.

Maybe I didn’t understood your question… Are you actually sharing a _form file view among your company and user models?