Adding Info About User Company + Several Goods In One Form

Hello again.

Don’t know, if it is a typical problem, but can’t figure how to realise it.

3 tables:

Application. It’s relations:

return array(

        'company_info' => array(self::HAS_ONE, 'AppCompany', 'applicant_id'),










AppCompany. Relations:

return array(

        'application' => array(self::BELONGS_TO, 'Application', 'applicant_id'),    

        'region' => array(self::BELONGS_TO, 'AppRegion', 'company_region_id'),

        'sector' => array(self::BELONGS_TO, 'AppSector', 'company_sector_id'),

        'goodsservices' => array(self::HAS_MANY, 'AppGoodsServices', 'company_id')   


App.GoodsServices. Relations:

return array(

        'company'=>array(self::BELONGS_TO, 'AppCompany', 'company_id'),


So, one user adds info about his company (company_name, date_of_registration etc), and than add some goods/services that this company produces. How to COLLECT, UPDATE AND VIEW all this information in one form? Is it possible?

How do I see this:

User addes some info and meets the field: "Goods and services and their percentage" and two fields - "GOODS AND SERVICES" and "PERCENTAGE" and ADD MORE button and he has 6 goods that he wants to add. So, he clicks on ADD MORE button and each time the new fields below appear. But the goods limit is 5, so the button becomes inactive after 5 fields have info.

And after SUBMIT button, all this info records to its table. It can be taken from table on UPDATE button and can be viewd in one CDetailView.

Please, how it can be implemented at least in general terms. Thank you

“all on one form” is real difficult to do. Doing two models on one form is tough. multiple entries into one of the models at the same time? No disrespect but, having looked through you other posting, that will be a long process. I’ve been at this a while and I’m not sure I could do in less than a week or two.

I would allow to add the Company. when validated and saved, redirect to a page that links to Add Services and a link to Add Percentage (or whatever). Then you can pass the company info to each of those pages for linkage.

My comment earlier was not meant to denigrate you. You are picking Yii up very quickly, but your current level seems a little below what you are trying to do. By all means dream big, but if the project needs to be done soon not sometime, then do it and look at version 2 for the really neat stuff :)

Keep on plugging dude, you’re doing good.

How does the user tie the company info to the application table? Is there like an application dropdown or something else for him to choose before he/she enters company + goods data?

I don’t know…I’m not writing the app(). Yes you could use a dropdown. on the ‘view’ of the Company you could just link to create the goodsCreate with a reference to the company (simular to the standard actionUpdate($id) call, but to the Goods::actionCreate($id) function.