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