Yii Framework Forum: Adding Info About User Company + Several Goods In One Form - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Adding Info About User Company + Several Goods In One Form Rate Topic: ***** 1 Votes

#1 User is offline   Decd 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 17-April 14

Posted 19 April 2014 - 03:23 AM

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'),
        'region'=>array(
                self::HAS_ONE,'AppRegion',array('company_region_id'=>'id'),
                    'through'=>'company_info'
            ),
        'sector'=>array(
                self::HAS_ONE,'AppSector',array('company_sector_id'=>'id'),
                    'through'=>'company_info'
            ),
		);


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**
0

#2 User is offline   jkofsky 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 536
  • Joined: 17-May 10
  • Location:Pensacola, Florida

Posted 23 April 2014 - 11:16 PM

View PostDecd, on 19 April 2014 - 03:23 AM, said:


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.
Do, or do not. There is no 'try.' Jedi Master Yoda
0

#3 User is offline   georaldc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 171
  • Joined: 08-July 11

Posted 24 April 2014 - 12:23 AM

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?
0

#4 User is offline   jkofsky 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 536
  • Joined: 17-May 10
  • Location:Pensacola, Florida

Posted 24 April 2014 - 02:21 AM

View Postgeoraldc, on 24 April 2014 - 12:23 AM, said:

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.
Do, or do not. There is no 'try.' Jedi Master Yoda
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users