Add tags autocomplete to search tags in advance search

Hi everyone,

I am trying to add the functionality of the autocomplete feature on the Add Tags tab in the item for to the advanced search --> search by tags. The line of code that I’ve identified when I inspect code in the browser is:

<input type="text" name="tags" size="20" id="tags" class="textinput ui-autocomplete-input" value="" autocomplete="off">

In the file /omeka/admin/themes/default/items/tag-form.php, the code looks like this:

<input type="text" name="tags" size="20" id="tags" class="textinput" value="" />

I tried to add these lines to the search-form.php file under search by tags like so:

        <div class="field">
            <div class="two columns alpha">
            <?php echo $this->formLabel('tag-search', __('Search By Tags')); ?>
            </div>
            <div class="five columns omega inputs">
        <input type="text" name="tags" size="20" id="tags" class="textinput ui-autocomplete-input" value="" autocomplete="off">
        <?php
                echo $this->formText('tags', @$_REQUEST['tags'],
                    array('size' => '40', 'id' => 'tag-search')
                );
            ?>
            </div>
        </div>
        </div>

But it doesn’t work. Does anyone have suggestions on how I can include this functionality within advanced search for Tags?

Thanks! Jen - Systems Librarian, American Museum of Natural History

Hello Omeka Community, I have made some headway with getting autocomplete to work on search for tags in the advanced search. There is still something blocking the tags from loading in the autocomplete. I see:

<input type="text" name="tags" id="tags" value="" size="40" class="ui-autocomplete-input ui-autocomplete-loading" autocomplete="off">

when I inspect element in my browser. I see the ui-autocomplete-loading every time I begin to type in the search box, but none of the tags load.

Here is the code from my search-form.php file. I have the following at the top of my file.

<?php echo js_tag('items'); ?>
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function () {
    Omeka.Items.tagChoices('#tags', <?php echo js_escape(url(array('controller'=>'tags', 'action'=>'autocomplete'), 'default', array(), true)); ?>);

   Omeka.wysiwyg({
        selector: false,
        forced_root_block: false
    });
});
</script>

Here is the code dealing specifically with tags in the advanced search form:

        <div class="field">
            <div class="two columns alpha">
            <?php echo $this->formLabel('tag-search', __('Search By Tags')); ?>
            </div>
            <div class="five columns omega inputs">
           <?php
                echo $this->formText('tags', @$_REQUEST['tags'],
                    array('size' => '40', 'id' => 'tags')
                );
            ?>
            </div>
        </div>

I can’t figure out why it’s not working :sob:

Thank you in advance for any help or suggestions! Jen

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.