Here is the point : usually, when I built an application in cakephp,
each input within my view matches a field within my table stored in
the database, so as you said, I can easily manipulate the value with
$this->data['ModelName']...
I am actually experiencing and facing a really different problematic :
in my current application, a user has to fill in a form. But regarding
his previous selection, the form can dynamically be readjusted,
leading to around 50 different combinations. The point is that I don't
want to create a table for each possible form.
So I have got the idea of creating an array, grouping the different
inputs within my form. so in my controller, I can concatenate each
input into a single variable, and store it into a single field in my
database, and retrieve it as a whole.

So in my view, I group different inputs as follow :
 echo $form->input('ModelName.myarray.field1');
 echo $form->input('ModelName.myarray.field2');
 echo $form->input('ModelName.myarray.field3');

In the controller, I can easily concatenate each value into a single
variable as follow :
foreach ($this->data['ModelName']['myarray'] as $key => $value) {
        $variable .= $value.'\n';
}

and then store $variable in one single field in my DB.

The problem, as you noticed, is that I am not able to apply any
validation rule for these input (grouped as an array).

any help or idea is welcome:)
Cheers

On 14 déc, 23:52, gearvOsh <[email protected]> wrote:
> Why/How is it a multidimensional array? If you use the FormHelper it
> builds it into a nicely formatted array in $this->data['ModelName'];
--~--~---------~--~----~------------~-------~--~----~
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