Re: HTML_QuickForm_SelectFilter

From: Date: Thu, 11 Aug 2005 14:03:27 +0000
Subject: Re: HTML_QuickForm_SelectFilter
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20374@lists.php.net to get a copy of this message
Thank you. This is really slick. It takes the same amount of keystrokes as the autocomplete but gives you a visual while typing, which is great for my application even though it takes up a little more room on the form. Plus it gives you an additional option, once you have filtered your select, but short of an exact match, you can scroll the select which allows the user to manually select. Again perfect for my application. Additional lanaigppe, works with Safari on the Mac, which autocomplete does not. May I suggest that at least these examples be posted on the pear site and/or included in the php file for hackers like me. Nicolas Hoizey <nicolas@hoizey.com> 08/10/2005 12:24 PM To PitesaJ@peteramayer.com cc pear-general@lists.php.net Subject Re: [PEAR] HTML_QuickForm_SelectFilter 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/ -- PEAR General Mailing List (http: //pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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