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

Bug #422 date.php setValue() doesn't allow value set of emptyOptionValue
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 OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


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 : 45 - 36 = ?

 
 [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

Comments

 [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.