Re: Pear QuickForm date element causing problems

From: Date: Tue, 10 Aug 2004 08:10:24 +0000
Subject: Re: Pear QuickForm date element causing problems
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14048@lists.php.net to get a copy of this message
Bertrand Mansion wrote:
Sam Miller wrote:
Yes, it is my code. The only thing was that I changed the label and name of the element because I didn't want to post the whole code (more than 500 lines)! The name used to be $i and the label $label. I don't think that it is necessary to post the whole code, but if you want to take a look at everything, I can gladly post the whole thing.
So you mean that 'format'=>'Y Y' is correct ? In this case, that's maybe wjat's giving you troubles. If what you want is 2 different year selects, you should use a group of 2 selects. It might also depend on the value in $i. Bertrand Mansion Mamasam PS: it is generally better accepted to write replies below the text of the original mail, not above...
Alexey Borzov wrote:
Hi, Sam Miller wrote:
I'm using PEAR's quickform. It is quite useful, but sometimes it also causes major headaches. Well, my problem at the moment is that I can't get the date element to work properly. My code is: $this->addElement('date', 'Birthdate', 'Date of Birth',
                  array('language'=>strtolower($_SESSION['language']),
                                             'format'=>'Y Y',
                                             'minYear'=>date('Y')-30,
                                             'maxYear'=>date('Y'),
                                             'addEmptyOption' => TRUE)
                                             );
This is obviously NOT your code (hint: 'format'). If your code is too precious to share, our time is too precious to waste.
Thanks for your reply. I am also using other date fields where the format is not 'Y Y'. For example there's the following code: $options = array(
            'language'  => 'en',
            'format'    => 'dMYHi',
            'addEmptyOption' => TRUE,
            'minYear'   => 2001,
            'maxYear'   => 2005,
            );
            $this->addElement('date', 'mydate', 'Choose date',$options);
It's the same problem here. QuickForm adds an empty option but it is added at the end of the select field and is not selected by default. Thoughts, anybody? Sam

« previous php.pear.general (#14048) next »