Jelix 1.6.37

autocomplete_htmlFormWidget extends WidgetBase
in package

Widget allowing to select a value by showing results from a search after the user starts to type a name. The search is made into a select html element filled by the datasource of the control, which should be a menulist.

See jAutocomplete jqueryui plugin, which is base on the autocomplete plugin.

If the select box may contain hundred values, prefer to use the autocompleteajax_html widget.

The widget accepts a specific attribute, 'attr-autocomplete', an array which should contains at least an item 'source' indicating the url of the search engine. The array may contains other attributes for the input element used to type the search term (class, style..).

example of use:

In the form file:

    <menulist ref="mylist"> <label>test</label>
    <datasource dao="mymodule~mydao"/>
    </menulist>

In a template:

{form $form, $submitAction, $submitParam, 'html', array('plugins'=>array(
     'mylist'=>'autocomplete_html'))}

{formcontrols}
   ... {ifctrl 'mylist'}{ctrl_control '', array(
         'attr-autocomplete'=>array('style'=>'width:40em;')}
       {else}{ctrl_control}{/ifctrl}
{/formcontrols}

Table of Contents

outputControl()  : mixed
outputJs()  : mixed

Methods

Search results