Although there are some discrepancies or missing inforrmation in the
Cookbook, the nice thing is that we, as a community, can offer
suggestions to improve it.  It's basically a huge moderated Wiki (or
integrated and web-based Trac system for documentation).
...either way, even without a definition in the method itself of what
$options can be filled with, what you were passing it was still
incorrect, based on the cookbook.  The values you can trry to pass to
the minute() or hour() methods can be found under:
http://book.cakephp.org/view/189/Automagic-Form-Elements -- see all
the $options['..........'] descriptions.

As for alternative sources, there's also the API and you can search
through the code to find the answers you need.  (api.cakephp.org)

On May 26, 4:58 pm, Bs <sommerf...@hs-heilbronn.de> wrote:
> Hi Brendon,
>
> the problem I have with the Cookbook is that many methods aren't
> documented that well. The "minute" function for example...I couldn't
> find any info what values are allowed for "attributes". The method is
> just defined but not documented that well.
>
> On 26 Mai, 20:24, Brendon Kozlowski <brendon...@hotmail.com> wrote:
>
>
>
> > It doesn't look like you're using the FormHelper's methods properly.
> > Looking at the API, and just the minute's method, I see it's
> > incorrectly used.
>
> > function minute($fieldName, $selected = null, $attributes = array(),
> > $showEmpty = true){
> >    //...
>
> > }
>
> > Check the book (book.cakephp.org) and Core Helpers to understand how
> > to use the Form methods with proper syntax and parameters.  (I think
> > you already have an idea of how to use them, but if it asks for an
> > array, supply it with an array or you might get undesirable and
> > unexpected results.)
>
> > On May 26, 12:24 pm, Bs <sommerf...@hs-heilbronn.de> wrote:
>
> > > Hi Stu,
>
> > > I tried it out with "datetime" column but that doesn't work, either.
> > > Result is "null" in the column.
> > > Here's part of my code:
>
> > > add.cpt:
> > > ...
> > > <tr>
> > >         <td style="text-align:right;">Opening time</td>
> > >         <td style="text-align:left;">from <?php echo $form->hour
> > > ('OpeningStartHours',1,6);?> : <?php echo $form->minute
> > > ('OpeningStartMinutes',0,null,"00");?>
> > >                                                  to <?php echo 
> > > $form->hour('OpeningEndHours',
> > > 1,18);?> : <?php echo $form->minute('OpeningEndMinutes',0,null,"00");?> 
> > > o'clock
>
> > >         </td>
> > > </tr>
> > > ...
>
> > > mycontroller:
> > > ....
> > > function add() {
> > > ....
> > > $startMinutes = $data['myobject']['OpeningStartMinutes'];
> > > $startHours = $data['myobject']['OpeningStartHours'];
> > > $endMinutes = $data['myobject']['OpeningEndMinutes'];
> > > $endHours = $data['myobject']['OpeningEndHours'];
> > > $data['myobject']['OpeningStartMinutes'] = $startMinutes['min'];
> > > $data['myobject']['OpeningStartHours'] = $startHours['hour'];
> > > $data['myobject']['OpeningEndMinutes'] = $endMinutes['min'];
> > > $data['myobject']['OpeningEndHours'] = $endHours['hour'];
> > > ....
>
> > > That way it works, but of course it's quite complicated always
> > > converting those values and storing them in 4 different fields.
>
> > > After your hint I tried it with a datetime "OpeningStart" and
> > > "OpeningEnd" field like this
> > > ...
> > > <tr>
> > >         <td style="text-align:right;">Opening time</td>
> > >         <td style="text-align:left;">from <?php echo $form->hour
> > > ('OpeningStart',1,6);?> : <?php echo $form->minute('OpeningStart',
> > > 0,null,"00");?>
> > >                                                  to <?php echo 
> > > $form->hour('OpeningEnd',1,18);?> :
> > > <?php echo $form->minute('OpeningEnd',0,null,"00");?> o'clock
> > >         </td>
> > > </tr>
> > > ...
>
> > > and commented out the conversion code in my controller, but that
> > > resulted in "null" values for "OpeningStart" and "OpeningEnd" in the
> > > database.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to