Skip to content

Latest commit

 

History

History
executable file
·
45 lines (33 loc) · 1.46 KB

autocomplete.md

File metadata and controls

executable file
·
45 lines (33 loc) · 1.46 KB

Autocomplete

The Places Autocomplete feature attaches to a text field on your web page, and monitors that field for character entries. As text is entered, Autocomplete returns Place predictions to the application in the form of a drop-down pick list. You can use the Places Autocomplete feature to help users find a specific location, or assist them with filling out address fields in online forms.

It internally uses the Places Autocomplete of the Fungio Google Map library.

Build your autocomplete

The bundle registers a new form type calles places_autocomplete which can be easily configured:

use Fungio\GoogleMap\Places\AutocompleteComponentRestriction;
use Fungio\GoogleMap\Places\AutocompleteType;

$builder->add('field', 'places_autocomplete', array(

    // Javascript prefix variable
    'prefix' => 'js_prefix_',

    // Autocomplete bound (array|Fungio\GoogleMap\Base\Bound)
    'bound'  => $bound,

    // Autocomplete types
    'types'  => array(
        AutocompleteType::CITIES,
        // ...
    ),

    // Autocomplete component restrictions
    'component_restrictions' => array(
        AutocompleteComponentRestriction::COUNTRY => 'fr',
        // ...
    ),

    // TRUE if the autocomplete is loaded asynchonously else FALSE
    'async' => false,

    // Autocomplete language
    'language' => 'en',
));