Re: Extending QF Select

From: Date: Wed, 22 Dec 2004 13:05:17 +0000
Subject: Re: Extending QF Select
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16412@lists.php.net to get a copy of this message
Hi, Aaron Wormus wrote:
I need to create a simple Yes/No select element, but am doing something wrong and QF is creating the element with the number of options doubled (Yes / No / Yes / No).
Constructors of elements are actually called *twice*. This is an unfortunate design decision that cannot be fixed in current major version of QuickForm. You can work around this issue by checking whether the options were already set and not passing them again in this case.
Following is my class; class yesNo extends HTML_QuickForm_select { function yesNo(){
             $options = array('1' => 'Yes',
                        '0' => 'No');        $data = func_get_args();
       parent::HTML_QuickForm_select($data[0], $data[1], $options);
} }


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