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

Bug #11717 Cannot set empty option as default for 'i' and 's'
Submitted: 2007-07-31 12:12 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  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 21 - 8 = ?

 
 [2007-07-31 12: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 14: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 15:38 UTC] shangxiao (David Sanders)
Alexey, I've added a patch that works for me.
 [2007-10-05 10: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.