I need some help with prototypes that are within prototypes. Symfony is very clever with generating form prototypes, but once you are one layer down (i.e. prototypes within prototypes), it reuses $$name$$ for both prototypes.
This is what a prototype field looks like for my entity. JQuery swaps out $$name$$ with the correct index value (based on number of child nodes)
<input type="text" id="entry_entities_$$name$$_contactFax" name="entry[entities][$$name$$][contactFax]" value="" />
So far so good. But when you go one level deeper, Symfony uses $$name$$ for the next level down too - here is a prototype for the entity property:
<div id="entry_entities_123_properties" data-prototype="
<label for="entry_entities_$$name$$_properties_$$name$$_name">Name</label>
<input type="text" id="entry_entities_$$name$$_properties_$$name$$_name" name="entry[entities][$$name$$][properties][$$name$$][name]" value="" />
This means that (in this example with entity id 123) that all properties get ID 123:
name="entry[entities][123][properties][123][name]"
name="entry[entities][123][properties][123][name]"
name="entry[entities][123][properties][123][name]"
etc.
In my opinion the best way to solve the issue would be to use $$somethingelse$$ for the property - does anyone know where this is set - or does anyone have a complete example with JS on how to solve this? I embarked on a horrible find/replace of the second $$name$$ on each line, but it got very messy. I'm sure there is an easy way to do this, but I couldn't find any guides on the internet.