Yellow Flag

This website version is not maintained anymore

Up to date documentation is available in Symfony 3.x website (see the dropdown menu above).

JavaScript options : put only one "add" button at the bottom

Use add_at_the_end option set to false (default) to create an add for each element of the collection.

Use add_at_the_end option set to true if you want to have only one add button, located below the collection.


This demostration is made of the following files (click to see on GitHub in a new tab):
    -     Controller/OptionsController.php
    -     Resources/views/Options/addButtonAtTheBottom.html.twig

With the option set to false

This is the default behaviour, an add button is added for each element of the collection.

Add, move, remove values and press Submit.
Value
Value
Value

Value :a

Value :b

Value :c

With the option set to true

Only one add button is available, located at the bottom of the collection.

Add, move, remove values and press Submit.
Value
Value
Value

Value :a

Value :b

Value :c


Code used:

    <script type="text/javascript">

        $('.disabled-collection').collection();

        $('.enabled-collection').collection({
            add_at_the_end: true
        });

    </script>