I've played with cake for awhile, but only recently had time to jump
into it.
I've setup a part management system that gives the manager the ability
to create profiles to capture specific part information. They can
customize ten text fields, giving them labels that show up on the part
form. They can make the fields Text, a input="text" element or Combo,
a select element. If the choose combo, they can add acceptable values
for the data entry people. The options are stored in partoptions with
the PartProfile_id, field (txt1...txt10) and finally the value, so you
could end up with records like this:
PartProfile_id  field   value
2                       txt1    1/8
2                       txt1    1/4
2                       txt1    1/2

...creating
<select name="txt1">
<option>1/8</option>
<option>1/4</option>
<option>1/2</option>
</select>

What I have done (pre cake) was: SELECT field, value WHERE
PartProfile_id=2, then something like:
foreach($items AS $item)
{
        if($item['field']=='txt1')
        {
                echo "<option>{$item['value']}</option>\n";
        }
}

What is the best way to handle the custom fields the cakephp way?

Models:
Parts (belongsto PartProfiles)
id
PartProfile_id
txt1
...
txt10

PartProfiles (HABTM Parts)
id
txt1label (varchar(50))
txt1type (Text|Combo)
...
txt10label (varchar(50))
txt10type (Text|Combo)

PartOptions
PartProfile_id
field (txt1...txt10)
value

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to