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 : without the given form theme

To manage complex collections, we should store the collection's field name prefix somewhere in the view in order to replace descendent prefixes properly. As this is not really natural to get this information from a view, a form theme is delivered with this jquery plugin. It does the job even if your collection has lots of descendent collections.

But this form theme does nothing more than setting plugin options so if you do not want to use it, that's up to you:


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

Value : a

Value : b

Value : c


Code used:

    <script type="text/javascript">

        /*
         * Please look at the source code by clicking on the withoutFormTheme.html.twig file above
         */
        $('.form-collection').collection({
            prototype_name: '__name__',
            allow_add: true,
            allow_remove: true,
            name_prefix:  'form[values]'
        });

    </script>