Re: QF_Livesearch

From: Date: Mon, 17 Dec 2007 21:33:00 +0000
Subject: Re: QF_Livesearch
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28342@lists.php.net to get a copy of this message
Köteles Zoltán írta:
Hello, I'd like to use QuickForm_Livesearch, but I always got an error. class.Livesearch.php file: class livesearch {
    var $livesearch;
    function getPublisherNames()
    {
        global $mdb2;
        $query = "
            SELECT p.publisher_id   AS publisher_id,
                   p.publisher_name AS publisher_name
            FROM Publishers AS p
            WHERE p.is_deleted = '0'
            ORDER BY p.publisher_name
        ";
        $result =& $mdb2->query($query);
        while ($row = $result->fetchRow()) {
            $this->livesearch[$row['publisher_id']] = $row['publisher_name'];
        }
    }
    function getPublisherName($input)
    {
        $ret = array();
        $this->getPublisherNames();
foreach($this->livesearch as $key => $value) { if (stristr($value,$input)) { $ret[$key] = $value; } } return $ret;
    }
} and my QF element: $form->addElement('livesearch_select', 'publisher_id', $locale->get('publisher'),
                 array(
                      'elementId'        => 'getPublisherName',
                      'callback'         => array('livesearch', 'callbackPublisherNames'),
                      'searchZeroLength' => 1,
                      'buffer'           => 350,
                      'printStyle'       => 1,
                      'autoComplete'     => 1
                      ),
                      array('size' => '50')
                  );
I think I found the problem. If I changed my function name lowercase, it's working perfectly (getPublisherName => getpublishername). Is it a bug?
Thanks ZoTyA

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