For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > December 2007 > Re: [PEAR] QF_Livesearch









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] QF_Livesearch
Köteles Zoltán

2007-12-17, 7:07 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com