Re: HTML_QuickForm_SelectFilter
| From: | Nicolas Hoizey | Date: | Wed, 10 Aug 2005 17:24:28 +0000 |
| Subject: | Re: HTML_QuickForm_SelectFilter | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20354@lists.php.net to get a copy of this message | ||
Hi,
require_once("HTML/QuickForm.php"); require_once("HTML/QuickForm/SelectFilter.php"); ... $sel = &$form->addElement('selectfilter','selname', 'Email :', $name_data); Nothing.Where is the "select" element you want to filter? Here is a sample I used to test the component during development: <?php require_once 'HTML/QuickForm/SelectFilter.php'; require_once 'HTML/QuickForm.php'; // Get some data require_once 'countries.php'; $form = new HTML_QuickForm('form', 'post'); // Add a filter on one list $form->addElement('SelectFilter', 'filter', 'List box 3 must contain:', null, 'listbox3'); $form->addElement('select', 'listbox3', 'List box 3:', $countries, array('size' => 4)); $form->addElement('submit', 'ok', 'Valider'); echo $form->toHtml(); ?> The "countries.php" script just sets a $countries array of country names, I think I have borrowed it from I18N or Translation. If you want to filter several selects with one single filter, it is a little more difficult: <?php require_once 'HTML/QuickForm/SelectFilter.php'; require_once 'HTML/QuickForm.php'; // Get some data require_once 'countries.php'; $form = new HTML_QuickForm('form', 'post'); // Add a filter on two lists $filter =& $form->createElement('SelectFilter', 'filter', 'List box 1 and 2 must begin with:'); $filter->addSelect('listbox1', true); $filter->addSelect('listbox2', true); $form->addElement($filter); $form->addElement('select', 'listbox1', 'List box 1:', $countries, array('size' => 4)); $form->addElement('select', 'listbox2', 'List box 2:', $countries, array('size' => 4)); $form->addElement('submit', 'ok', 'Valider'); echo $form->toHtml(); ?> HTH -Nicolas -- Nicolas "Brush" HOIZEY Clever Age : http://www.clever-age.com/ Gastero Prod : http://www.gasteroprod.com/ phpMyChat : http://phpmychat.sf.net/