Php quickform date
| From: | zia mohaddes | Date: | Wed, 03 Mar 2010 16:41:47 +0000 |
| Subject: | Php quickform date | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-30351@lists.php.net to get a copy of this message | ||
Hello everyone,
I am currently using a class called HTML_QuickForm_date
(/usr/share/php/HTML/QuickForm). And I would like to have an array appended
to 'emptyOptiontext'. For example in my program I would like to use
$arr = array("text1" => null, "text2" =>
"not_answered");
$config =& NDB_Config::singleton();
$this->dateOptions = array(
'language' => 'en',
'format' => 'YMd',
'minYear' => $config->getSetting('startYear'),
'maxYear' => $config->getSetting('endYear'),
'addEmptyOption' => true
'emptyOptionText' => $arr
);
where array contains the the two text values which I want the
'emptyoptiontext' to represent. Hower when I do :
$this->form->createElement("date","interview_start_date", null,
$this->dateOptions); I get the word 'array' in the drop-down...
I have looked at the date class in /usr/share/php/HTML/QuickForm and have
noticed this line of code:
if (is_array($this->_options['emptyOptionText']) &&
!empty($this->_options['emptyOptionText'][$sign])) {
$options =
array($this->_options['emptyOptionValue'] =>
$this->_options['emptyOptionText'][$sign]) + $options;
which means that _options['emptyOptionText'] can be an array. So I am
wondering if this class allows this functionality , if not what is the best
way to make this happen, without having to write another class that does
this....
I would highly appreciate if you could give me some feedback to how I could
make this work using the given Quickform php date class..
thank you so much for your time in advance!
regards,