Can I have multiple levels of nested cloned forms using SheepIt JQuery plugin?

試著忘記壹切 提交于 2020-01-24 19:01:08

问题


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'];


来源:https://stackoverflow.com/questions/10047937/can-i-have-multiple-levels-of-nested-cloned-forms-using-sheepit-jquery-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!