On Fri, Nov 5, 2010 at 12:33 AM, Adam <adamcbre...@gmail.com> wrote:
> Thanks Paul,
>
> I really wanted it in a standard, form-helper format - YYYY - MM - DD
> drop-downs.
>
> I spent more time on it than i wanted to so in the end I just exploded
> the date value from the DB and manually assigned them each to day,
> month and year form-inputs with their set values.
>
> Like I said before, this has never been a problem for me in the past,
> but It was with code that someone else had built before me, so maybe
> I'll use that as an excuse ; )

I just tested in 1.3.5 and it worked fine:

echo $this->Form->dateTime('Site.created', 'YMD');

Note what the docs say:
http://book.cakephp.org/view/1418/dateTime
dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12',
$selected = null, $attributes = array())

"You also can pre-select the current datetime by setting $selected =
null and $attributes = array("empty" => false)"

You can see, above, that I did pass null for the $selected param.
However, I did not pass false for 'empty'. Perhaps your problem lies
there.

No, wait. If I do:

echo $this->Form->dateTime('Site.created', 'YMD', '24', null, array());

... I still get the value from the DB. Change that to:

echo $this->Form->dateTime('Site.created', 'YMD', '24', null,
array('empty' => false));

... of course, I still get the correct value, because it's set. Are
you certain that you're using the correct field, and that it
definitely has a value? DO a debug($this->data) in your form view to
be sure.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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