I read the many posts and articles on HABTM and extra-field but my
problem is a little bit more difficult (to me) than the simple
examples I found there.
I'd like to implement a system to evaluate some parameter.
The parameter has a model and is HABTM with the main model.
In the HABTM table I added an extra-field, "rate" and the values for
this field should be filled with the values coming from another model.
To simplify let's say that the form should be like the following (the
capital O is for a radio button):
- health: O bad - O good - O very good
- money: O bad - O good - O very good
- ...
Let's suppose that the rate field has fixed option (to fill the select
with options is not a problem).
health, money and so on come from the parameter table and I'd like the
rate value checked for that parameter to be saved in the extra field.
I tried but I don't know what is the correct syntax. Cake generates
html code different from the one used in the examples I found (teknoid
and Mariano Iglesias).
I tried with:
$i=0;
foreach ($parameters as $parameter =>$v):
echo $form->input('parameter.parameter.'.$i, array
('type'=>'hidden', 'value'=>$parameter));
echo $form->select('parameter.parameter.'.$i++.'.value', array
('aa'=>'bad','bb'=>'good'));
endforeach;
with double or single model name and many other variation but no way.
$this->data in the controller is wrong of course, something like the
following:
[Parameter] => Array
(
[Parameter] => Array
(
[0] => Array
(
[rate] => aa
)
[1] => Array
(
[rate] => bb
)
)
)
Any suggestion?
Thank you
maxx
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---