Can I have multiple levels of nested cloned forms

2019-07-22 19:32发布

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#'
            }
        }
         ]

2条回答
倾城 Initia
2楼-- · 2019-07-22 19:38

Add this line to function normalizeFieldsForForm after "that" declaration

var nameTemplateAttr = that[0]['name'];
查看更多
迷人小祖宗
3楼-- · 2019-07-22 19:55

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.

查看更多
登录 后发表回答