Skip to content

Latest commit

 

History

History
41 lines (35 loc) · 1.03 KB

File metadata and controls

41 lines (35 loc) · 1.03 KB

Use JQueryAutocomplete to suggest values on a text field

Minimal configuration:

# app/config/config.yml
genemu_form:
    autocomplete: ~

Usage:

<?php
// ...
public function buildForm(FormBuilder $builder, array $options)
{
    $builder
        // Text suggestions
        ->add('soccer_player', 'genemu_jqueryautocomplete_text', array(
            'suggestions' => array(
                'Ozil',
                'Van Persie'
            ),
        ))
        // Suggestions with doctrine orm
        ->add('soccer_player', 'genemu_jqueryautocomplete_entity', array(
            'class' => 'MyBundle\Entity\MyEntity',
            'property' => 'name',
        ))
        // Suggestions with doctrine odm
        ->add('soccer_player', 'genemu_jqueryautocomplete_document', array(
            'class' => 'MyBundle\Document\MyDocument',
            'property' => 'name',
        ));
}

Extra

Ajax Suggestions