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?
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.yiiframework.com/doc/guide/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).