Home » Database » DB_DataObject_FormBuilder » Bug #422
date.php setValue() doesn't allow value set of emptyOptionValue
Details
| Submitted | 2003-12-13 10:34 UTC |
|---|---|
| From | orya at ntlworld dot com |
| Assigned | mw21st |
| Status | Closed |
| Package | DB_DataObject_FormBuilder |
| PHP Version | 4.3.3 |
| Roadmaps | (Not assigned) |
Comments
[2003-12-13 10:34 UTC] orya at ntlworld dot com
Description:
------------
The setValue() function of the date element does not allow to set
the value to the emptyOptionValue when addEmptyOption is
enabled.
Here is my fix to the code:
function setValue($value)
{
if ($value == $this->_options['emptyOptionValue'] &&
$this->_options['addEmptyOption']) {
$value = array(
'D','l','d','M','m','F','Y','y','h','H','i','s','a','A'
=> $this->_options['emptyOptionValue']
);
} elseif (!is_array($value)) {
// might be a unix epoch, then we fill all possible values
$arr = explode('-', date('w-d-n-Y-y-h-H-i-s-a-A',
(int)$value));
$value = array(
'D' => $arr[0],
'l' => $arr[0],
'd' => $arr[1],
'M' => $arr[2],
'm' => $arr[2],
'F' => $arr[2],
'Y' => $arr[3],
'y' => $arr[3],
'h' => $arr[4],
'H' => $arr[5],
'i' => $arr[6],
's' => $arr[7],
'a' => $arr[8],
'A' => $arr[9]
);
}
parent::setValue($value);
}
Also see "Re: [PEAR] FormBuilder Element Group Processing
Solution" in pear-general
[2004-03-14 18:05 UTC] mw21st at php dot net
This is not a FormBuilder bug, setValue() is a method of HTML_QuickForm's date elment.