Sorry for the late reply. I've been running between meetings for a few
days.
Say that a Question has a field called "type".
In your model you could use that "key" to help in stats calculation
and even storage.
In your views you could select the correct element based on that key:
echo $this->element('form_'.$data['Question']['type'])
If you have a big if-else clause you can almost always do without it.
If you have some other data related to each type. Store it in an array
and call it like this:
$some_data = $this->type_data[$data['Question']['type']]
If you need to Store the answers in a different table for each type of
question:
$model_name = $data['Question']['type'];
$this->$model_name->findBySomething(...);
/Martin
On Nov 8, 1:00 am, pgraju <[EMAIL PROTECTED]> wrote:
> Thanks for the reply!
>
> "To choose the correct gui element, I would, in the view (not the
> controller), use the same logic that sets which type of question it is
> for the model side of things."
>
> I'm not sure what you mean by this, would I put in conditional steps
> in the view i.e
>
> if model_says textbox then
> do textbox
> else if model_says scale_1_5 then
> do scale_1_5
> else if
> ....
>
> Would you set something like that up in the view?
>
> I might put together a tutorial on this as well if I can finally get
> it going :)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---