I suggest to use this approach:
In your View:
// The 2^ param 'MDY' for the sequence of selects
echo $html->dateTimeOptionTag('Client/dob', 'MDY', 'NONE',
$data['Client']['dob'], array(), false);
In your controller
$this->cleanupFields(); // automagically buld a single fields from the group
of date selects
$this->Client->save($this->data);
HTH
For more reference see the manual or api
> -----Messaggio originale-----
> Da: [email protected]
> [mailto:[EMAIL PROTECTED] Per conto di cake_learner
> Inviato: mercoledì 30 maggio 2007 15.15
> A: Cake PHP
> Oggetto: Date
>
>
> I am trying to insert date into database.
>
> fieldname: dob
> type: date (y:m:d)
>
>
> views code:
>
>
> <?php echo $html->dayOptionTag('Client/d', $value = null,
> $selected = null, $selectAttr = null, $optionAttr = null,
> $showEmpty = true);?>
> <?php echo $html->monthOptionTag('Client/m',
> $value = null, $selected = null, $selectAttr = null,
> $optionAttr = null, $showEmpty = true)?>
>
>
> <?php echo $html->yearOptionTag('Client/y',
> $value = null, $minYear = null, $maxYear = null, $selected =
> null, $selectAttr = null, $optionAttr = null, $showEmpty = true)?>
>
>
> In the controller i have the code,
>
>
> $this->Client->save($this->data);
>
>
> 1. How do i save date, month, year in one field?
>
>
> 2. The controller has many drop down (select tag), whose
> data is coming from different tables. While saving should i
> have to say as $this-Client->save? The class has been
> declared as, class ClientsController extends AppController
>
>
> 3. As i have allready mentioned the controller code contains
> many dropdown tag.
> example : $this->set('City', $this->City->generateList(
> null, "city_id ASC", null, "{n}.City.city_id",
> "{n}.City.city")
> );
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---