is the output of $zdate->getIso() correct?

On Sat, Dec 20, 2008 at 7:36 AM, Barrett Conrad <barrettcon...@gmail.com>wrote:

> I know this post if aging, but I'm still having some difficulty with it.
>
> I attempted using Zend_Date's getIso, with basically no change.
>
> class My_Zend_Form extends Zend_Form {
>
> public function init() {
>
> // ... GET $obj ROW FROM DATABASE
>
> $date = new Zend_Dojo_Form_Element_DateTextBox('date');
>  $zdate = new Zend_Date();
>
> // $obj->date is from MySQL and formatted as 'Y-m-d'
> $zdate->set($obj->date, Zend_Date::ISO_8601);
>
> // METHOD 1
> $date->setValue($zdate->getIso());
>
> // METHOD 2
> $this->populate(array('date' => $obj->date));
>
> $this->addElements(array($date));
>
> // I ATTEMPTED METHOD 2 HERE AFTER ADDING THE ELEMENTS JUST TO BE SURE
> }
>
> The form still pops on the screen with the right date and then it
> disappears from the form element once the JavaScript kicks in.
>
> Thanks again for the help.
>
> On Dec 14, 2008, at 9:01 PM, Cameron wrote:
>
> 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