Using input/autocomplete with elgg_view


I'm trying to create a view that uses the "input/autocomplete" text input.

The code in this test view is:

<div class="contentWrapper">
<form action="<?php echo $vars['url']; ?>action/issues/new" enctype="multipart/form-data" method="post">
        <?php echo elgg_view('input/securitytoken'); ?>
                <label><?php echo elgg_echo("issues:icon"); ?><br />
                        echo elgg_view("input/autocomplete",array('internalname' => 'issuer','match_on'=>'group'));
                <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />


And the generated code seems to look OK - except that it does not pick out matching groups - the little ticker spins but nothing shows up. I cant find any other reference to sample code on google for input/autocomplete so does this work?





  • Update: Solved it with the following code. Thanks again to both of you guys.

    case 'words':

    // don't return results if groups aren't enabled.

    $query = "SELECT * FROM {$CONFIG->dbprefix}objects_entity as oe, {$CONFIG->dbprefix}entities as e

    WHERE e.guid = oe.guid

    AND e.enabled = 'yes'


                            AND e.subtype = '43'

    AND (oe.title LIKE '$q%' OR oe.description LIKE '%$q%')

    LIMIT $limit


                        if ($entities = get_data($query)) {

                            foreach ($entities as $entity) {

                                $json = json_encode(array(

                                            'type' => 'object',

                                            'subtype' => 'word',

                                            'name' => $entity->title,

                                            'desc' => elgg_get_excerpt(strip_tags($entity->description), 30),

                                            'icon' => '',

                                            'guid' => $entity->guid


                                //$results[$entity->name . rand(1,100)] = "$json|{$entity->guid}";

                                $results[$entity->title . rand(1, 100)] = $json;