Issues

ZF-7813: setValue() doesn't work for TimeTextBox and DateTextBox form elements

Issue Type: Bug Created: 2009-09-09T09:37:27.000+0000 Last Updated: 2011-09-11T19:33:07.000+0000 Status: Resolved Fix version(s): Reporter: Kim Blomqvist (kblomqvist) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Dojo

Related issues: Attachments: - ZF-7813-tests.diff

Description

It seems like setValue() does nothing for TimeTextBox and DateTextBox. Following examples don't work. \

<pre class="highlight">
$this->addElement('TimeTextBox', 'myTime', array(
    'required'           => true,
    'label'              => 'myTime',
    'timePattern'        => 'HH:mm',
    'visibleRange'       => 'T02:00:00',
    'visibleIncrement'   => 'T00:30:00',
    'clickableIncrement' => 'T00:15:00',
    'value'              => '08:00'
));



<pre class="highlight">
$this->addElement('TimeTextBox', 'myTime', array(
    'required'           => true,
    'label'              => 'myTime',
    'timePattern'        => 'HH:mm',
    'visibleRange'       => 'T02:00:00',
    'visibleIncrement'   => 'T00:30:00',
    'clickableIncrement' => 'T00:15:00'
));
$this->getElement('myTime')->setValue('08:00');



<pre class="highlight">
// In controller
$myTimeForm->getElement('myTime')->setValue('08:00');

Comments

Posted by Kim Blomqvist (kblomqvist) on 2009-10-17T11:34:13.000+0000

The value has to be in the correct form that isn't the form how user would fill the field. For example '08:00' -> 'T08:00:00'.

I think that this isn't the issue anymore.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-10-17T12:26:32.000+0000

I think Kim is right when saying that you should just give the value Dojo expects. I can however imagine this all to accept instances of Zend_Date...

Posted by Robert Basic (robertbasic) on 2011-08-28T09:35:44.000+0000

Tests for asserting that value can be set on DateTextBox and TimeTextBox elements.

Posted by Robert Basic (robertbasic) on 2011-08-28T09:37:50.000+0000

Closing this as not an issue.

Will open a ticket against ZF2 to add the possibility of passing a Zend\Date to DateTextBox and TimeTextBox.

Posted by Pádraic Brady (padraic) on 2011-08-28T10:44:46.000+0000

I've reviewed the patch and confirm it operates as intended. Recommend committing to trunk and merging to release branch.

Posted by Kim Blomqvist (kblomqvist) on 2011-08-28T14:49:33.000+0000

bq. Closing this as not an issue. I think that the problem here was that one cannot set value by saying setValue('08:00') but setValue('T08:00').

bq. Will open a ticket against ZF2 to add the possibility of passing a Zend\Date to DateTextBox and TimeTextBox. In ZF2 this setter should accept all valid time formats in string too so that 08:00 is as valid as T08:00.

Posted by Pádraic Brady (padraic) on 2011-09-11T19:33:06.000+0000

Committed the attached tests to r24460

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts