[Tickets #3218] RESOLVED: hourminutesecond form incorrectly shows '00' selected for blank dates

bugs@bugs.horde.org bugs at bugs.horde.org
Sat Jan 7 02:01:33 PST 2006


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: https://dev.horde.org/horde/whups/ticket/?id=3218
-----------------------------------------------------------------------
 Ticket             | 3218
 Updated By         | robin at rainton.com
 Summary            | hourminutesecond form incorrectly shows '00' selected for blank dates
 Queue              | Horde Framework Packages
 Version            | HEAD
 State              | Resolved
 Priority           | 2. Medium
 Type               | Bug
 Owners             | 
-----------------------------------------------------------------------


robin at rainton.com (2006-01-07 02:01) wrote:

Ah, actually, by just checking for null this doesn't work on a refresehed
form. This is because on the refresh the time values are nothing ('') as per
the option and this is then converted to zero.

Checking for empty values is a better option:

$this->_selectOptions($hours, (empty($time['hour'])) ? '' : sprintf('%02d',
$time['hour'])),

&

$this->_selectOptions($minutes, (empty($time['minute'])) ? '' :
sprintf('%02d', $time['minute'])),

If you want to get pedantic passing nothing ('') rather than null (as above)
is also more technically correct isn't it?




More information about the bugs mailing list