Sure.
The following example uses Cake 1.2's FormHelper, but the general
syntax should work for 1.1's HTMLHelper:
for ($i=0;$i<$weekMax;$i++) {
echo $form->text('User.start]['.$i);
}
Or you could just generate the inputs by hand, using the structure:
<input type="text" id="UserStart1" name="data[User][start][1]"
value="" />
<input type="text" id="UserStart2" name="data[User][start][2]"
value="" />
etc.
Using either of the above methods, the $this->data array in your
controller will have $this->data['start'] as an array with the same
number of elements you specified in your view. You could then
serialize this array before storing it in your DB to reduce the number
of fields you need.
Hope this helps,
Casey
On Oct 16, 12:20 pm, MarsDev <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I am building a training scheduling app where I am stuck at the weekly
> schedule list form. Each training class is a multi-week schedule,
> somewhere between 15-20 weeks. I have a table that keep tracks thes
> length of the training class. However, when it comes to the frontend
> rendering, I don't know how to assign the text fields to capture all
> the start date / end date of the each week:
>
> For example:
> <tr>
> <td>Week 1</td>
> <td>
> <?php echo $html->input('User/start_date', array('size' =>
> '20')?>
> <?php echo $html->tagErrorMsg('User/start_date', 'Start Date
> is required'); ?>
>
> </td>
>
> <td>
> <?php echo $html->input('User/end_date', array('size'
> => '20')?>
> <?php echo
> $html->tagErrorMsg('User/end_date', 'End Date is required'); ?>
>
> </td>
> </tr>
> ...
> ...
>
> Is there some way to make cakePHP keep all week schedule data into
> $this->data['User']['start'][0] to $this->data['User']['start'][15],
> for instance? If so, what should I put for the first parameter of
> HtmlHelper::input() method?
>
> Thanks a lot!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---