You need to pass the element an ISO date. Try something like this:

$date = new Zend_Date();
$date->set($row['date'], Zend_Date::ISO_8601);
$retarr['auction_date'] = $date->getIso();


Interestingly enough, the Time picker accepts the full ISO date too, if
you're using them. Unfortunately you need to do this for every date/time
dojo field and datetime you pull out of a mysql DB, because mysql misses the
"T" in the middle - although it happily accepts an ISO date as an input, it
stores it without. Quite annoying, really.


On Mon, Dec 15, 2008 at 4:53 AM, Barrett Conrad <barrettcon...@gmail.com>wrote:

> Hello all.  I am attempting to use a Zend_Dojo_Form_Element_DateTextBox in
> a Zend_Form and I am unable to set the default value for the date picker.
>  The element works fine if the form/element validates, but the element does
> not retain its value when the validation fails or it has no value at all if
> I am populating it with existing data.  I am currently trying to use
> ->setValue on the element within the Zend_Form, and that works up to the
> initial page load; once Dojo kicks in and turns the element into a date
> picker it appears to strip the value of the input.  A simple example of what
> I am trying is:
>
> class My_Zend_Form extends Zend_Form {
>
>        public function init() {
>
>                $date = new Zend_Dojo_Form_Element_DateTextBox('date');
>
>                $date->setLabel('Date')
>                        ->setValue(date('m/d/Y'));
>
>                $this->addElements(array($date));
>        }
>
> }
>
> Just to be clear, all other elements of the form work just fine;  only the
> Dojo date picker has problems.
>
> Thanks for the assistance,
> Barrett M. Conrad
>

Reply via email to