cvs: pear /HTML_QuickForm/QuickForm date.php
| From: | Bertrand Mansion | Date: | Sat, 03 Jan 2004 10:32:38 +0000 |
| Subject: | cvs: pear /HTML_QuickForm/QuickForm date.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-15307@lists.php.net to get a copy of this message | ||
mansion Sat Jan 3 05:32:38 2004 EDT
Modified files:
/pear/HTML_QuickForm/QuickForm date.php
Log:
Fix a bug spotted by Orya related to empty default values setting the date to 'now'
instead of the empty option (when available).
Index: pear/HTML_QuickForm/QuickForm/date.php
diff -u pear/HTML_QuickForm/QuickForm/date.php:1.39 pear/HTML_QuickForm/QuickForm/date.php:1.40
--- pear/HTML_QuickForm/QuickForm/date.php:1.39 Fri Jan 2 12:37:10 2004
+++ pear/HTML_QuickForm/QuickForm/date.php Sat Jan 3 05:32:38 2004
@@ -18,7 +18,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: date.php,v 1.39 2004/01/02 17:37:10 mansion Exp $
+// $Id: date.php,v 1.40 2004/01/03 10:32:38 mansion Exp $
require_once 'HTML/QuickForm/group.php';
require_once 'HTML/QuickForm/select.php';
@@ -61,7 +61,7 @@
* 'maxYear': Maximum year in year select
* 'addEmptyOption': Should an empty option be added to the top of
* each select box?
- * 'emptyOptionVal': The value passed by the empty option.
+ * 'emptyOptionValue': The value passed by the empty option.
* 'emptyOptionText': The text displayed for the empty option.
* 'optionIncrement': Step to increase the option values by (works for 'i'
and 's')
*
@@ -344,7 +344,9 @@
function setValue($value)
{
- if (!is_array($value)) {
+ if ($this->_options['addEmptyOption'] && empty($value)) {
+ $value = array();
+ } else if (!is_array($value)) {
// might be a unix epoch, then we fill all possible values
$arr = explode('-', date('w-d-n-Y-h-H-i-s-a-A', (int)$value));
$value = array(