Yii Framework Forum: activeCheckboxList/activeDropdownList - how to populate from one table and save to another? - Yii Framework Forum

Jump to content

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

activeCheckboxList/activeDropdownList - how to populate from one table and save to another? Rate Topic: -----

#1 User is offline   smclark89 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 119
  • Joined: 20-June 09
  • Location:NY, USA

Posted 22 April 2010 - 07:07 PM

For a project I'm working on, I need to create a checkbox list (or three dropdowns, either works). The list needs to be the labels from a table called Issue_Types along with their PK's, and then save each selections into a separate row in a table called Issues.

For example, I need a list of Issue A, Issue B, Issue C, and Issue D (from issue_types table); then save each checked issue into it's own row in the Issue table - or update, if the row has already been inserted.

For some reason this has turned into a nightmare, and I can't figure out how to do it with Yii. It seems really basic, so I thought I'd ask in case I'm missing something. Does anybody have suggestions?
0

#2 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 23 April 2010 - 01:00 AM

If it's a fixed number of check boxes or drop downs then just check each one. You could probably use Tabular Input (http://www.yiiframew...uide/form.table), You check each selection then check if that selection exist in the issues table if it does then you update if not you create it. I can't see where you could go wrong or lost here.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#3 User is offline   smclark89 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 119
  • Joined: 20-June 09
  • Location:NY, USA

Posted 23 April 2010 - 11:51 AM

View PostVince., on 23 April 2010 - 01:00 AM, said:

If it's a fixed number of check boxes or drop downs then just check each one. You could probably use Tabular Input (http://www.yiiframew...uide/form.table), You check each selection then check if that selection exist in the issues table if it does then you update if not you create it. I can't see where you could go wrong or lost here.


I looked over the tabular input page, which is what I've used for other projects - but since each checkbox needs extra information along with it (like a primary key and such) to check if it exists, how would I do that? When the checkbox array gets passed along, there's not a good way to assign each piece of the array it's PK (if one even exists).
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