Can I have multiple levels of nested cloned forms

2019-07-22 19:13发布

问题:

I have tried, with no avail, to create a nestedForm inside of another nestedForm using the SheepIt! plugin. Is this even possible?

Extending Demo 7 on the SheepIt! website, I tried to add an additional nested form in JSFiddle

But I get a indexOf error...

Remove the following section to get rid of the error but break the intended functionality: JSFiddle

,
         nestedForms: [
        {
                id: 'person_addresses_#index#_phones_#index_phones#_tests',
                    options: {
                indexFormat: '#index_tests#'
            }
        }
         ]

回答1:

Here is the JSFiddle Solution

It seems that the SheepIt! plugin only likes to see one index in nestedForm ID. It was giving me the indexOf error because it was hitting the first #index#. You can still use multiple indexes in your inputs and it will fill them out as expected.



回答2:

Add this line to function normalizeFieldsForForm after "that" declaration

var nameTemplateAttr = that[0]['name'];