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 : Initialize your collection with a given minimum number of elements

Use init_with_n_elements option to ensure that your collection will be initialized with the given number of arguments.

This demostration is made of the following files (click to see on GitHub in a new tab):
    -     Controller/OptionsController.php
    -     Resources/views/Options/givenMinimumElements.html.twig
Add, move, remove values and press Submit.

Code used:

    <script type="text/javascript">

        // Form is initialized without any element, but 5 empty elements
        // are created at startup.
            init_with_n_elements: 5