-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add a prefix option to the colletion type #13837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Why not simply tell the users to set the |
Hello @Tobion , If you have a collection of form collections and simply use I do not agree that this is implementation specific because without the collection's field name, we (the whole community) are limited to manage simple collections. This information is really important to give more flexibility about the way to use that field type. |
I guess what you are looking for is |
And have you seen #10071 |
Hello @Tobion About #10071, this is about adding and removing elements, but not adding elements at a specific position or moving them. We still need to have the collection's field name to do that job. I do not know if you're reading emails or browsing github, as I edited my original question to give more details I think you'll get the point now. I assume that moving elements inside a collection is not specific (as well as adding and removing elements). It is really useful to move elements or add elements at a given position. A real use case of collection of form collections for example, when you should manage a set of rules executed in the given order and that can contain an arbitrary number of conditions and actions: So if you think I do not need the collection's prefix to move a collection even in it contains an arbitrary number of collections (following my question's example), can you give me some hints about the way to rename the descendant form fields? Thank you |
I am closing this old issue as it seems nobody is interested in making it happen. |
As @nicolas-grekas added this issue as a EUFOSSA one, could it be a good idea to reconsider the idea of working on it? Don't know if @ninsuo is maintaining the lib but for current usages, it could be a good idea to reconsider the solution? 🤔 |
Hello, No i'm not maintaining it anymore. It needs to be rewritten using the backend more, because putting everything on the client side adds lots of complexity and is resourceful. But yes, this feature is definitely relevant for complex forms. Cheers |
Hello,
I'm trying to create this generic jquery plugin to handle form collections. It aims to manage adding, deleting and moving field sets up and down.
That's quite easy to do this on simple collections thanks to the
prototype
option, but I'm trying to also manage collections or form collections. For addition and deletion of collections, that's easy, but to move them, that's really hard as we need to updatename
attributes accordingly.If I simplify the problem:
To swap 2 elements in the child collection
form_collections_1
, I just need to replace all names beginning byform[collections][1][positionElemA]
byform[collections][1][positionElemB]
(and vice-versa). But in fact, I am missing theform[collections][1]
prefix.To swap 2 elements in the parent collection
form_collections
, I just need to iterate the very same way throught all form fields contained in the moved elements. I replace all names beginning byform[collections][positionElemA]
byform[collections][positionElemB]
(and vice-versa). I still need to find theform[collections]
prefix somewhere.The second case is more explicit because it contains no fields having a name attribute, so I can't guess in any way from the prototype or anything else what could be the collection's prefix.
This information, stored in
full_name
variable in the form theme, is very easy to get. But that's not friendly to ask my users (or even yours if you begin to work on a similar plugin) to overwrite the Symfony's default theme just to add buttons to their forms, so here come the idea:Do you think it worth a PR to add this prefix option on collection field type, that will set a
data-prefix="{{ full_name }}"
attribute in the collection's container?The text was updated successfully, but these errors were encountered: