Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.2.13

Bug #11717 Cannot set empty option as default for 'i' and 's'
Submitted: 2007-07-31 07:12 UTC Modified: 2007-10-05 05:59 UTC
From: shangxiao Assigned: avb
Status: Closed Package: HTML_QuickForm (version 3.2.9)
PHP Version: 5.2.3 OS: Linux
Roadmaps: 3.2.10    
Subscription  


 [2007-07-31 07:12 UTC] shangxiao (David Sanders)
Description: ------------ It's impossible to set the empty option as a default for 'i' and 's' formats. Test script: --------------- require_once 'HTML/QuickForm.php'; $form = new HTML_QuickForm; $form->addElement('date', 'test', 'Test', array('addEmptyOption' => true, 'format' => 's i')); $form->setDefaults(array('test' => array('s' => '', 'i' => ''))); $form->display(); Expected result: ---------------- 2 dropdowns, with the empty option selected Actual result: -------------- Both dropdowns have '00' selected

Comments

 [2007-07-31 09:51 UTC] avb (Alexey Borzov)
Looks like this was introduced in 3.2.9, the function to trim the leading zeroes in date::setValue() effectively replaces an empty string by a zero.
 [2007-07-31 10:38 UTC] shangxiao (David Sanders)
Alexey, I've added a patch that works for me.
 [2007-10-05 05:59 UTC] avb (Alexey Borzov)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Thanks for the patch, I applied a slightly modified version of that.