SproutCMS

This is the code documentation for the SproutCMS project

function autocompleteList()

Render autocomplete multi-list

Usage

string Fb::autocompleteList ( string $name , array $attrs , array $options );

Arguments

  1. string $name
    Form field name
  2. array $attrs
    Extra attributes for the INPUT element
         'data-callback' (string )Function name to call once a selection has been made,
             which should accept the same params as endpoint response listed below.
  3. array $options
    Keys as follows:
         'url' (string) ajax called endpoint to populate autocomplete list
                 Endpoint to acccept:
                     $_GET['q'] (string) Search keyword
                     $_GET['ids'] (string) CSV of record IDs to poplate on page-load
                 Endpoint to return (json):
                     'id' (int) Record ID
                     'value' (string) Record label
    
         'chars' (int, defaults to 2) Minimum number of characters required before first AJAX lookup fires.
               If zero, the lookup will happen on focus.

Return value

  • string
    A HTML INPUT element and associated SCRIPT element