Yapapaya / jquery-cloneya

A jquery plugin to clone DOM elements
MIT License
76 stars 28 forks source link

Nested child incrementing the parent name #53

Closed absmugz closed 8 years ago

absmugz commented 8 years ago

I have a challenge were I have a nested form and the nested form must have children, but when I try to add the child form in incrementing the parent name

`

Questions

```

```
Answer option

```

clone delete
clone delete
            </div>
            <!-- <a href="#" class="clone">clone</a>
            <a href="#" class="delete">delete</a> -->
        </div>

        <p class="submit"> 
            <input type="submit" value="Save" /> 
        </p> 

    </form>`


I want to get data like this -

question[0][ques]
question[0][ans]
question[0][ansInfo]

The above part works but now for the nested I want this -

question[0][ansSel][0]
question[0][ansSel]1]
question[0][ansSel][2]
question[0][ansSel][3]

But when I click the clone button for the nested child form it does this - 

question[1][ansSel]
question[2][ansSel]
question[3][ansSel]
question[4][ansSel]
actual-saurabh commented 8 years ago

Hey @absmugz,

You should use the after_clone and before_append events (https://github.com/yapapaya/jquery-cloneya/wiki/Events#after_clone) to manage this on your own. Cloneya cannot manage this sensibly for the numerous use cases.

actual-saurabh commented 8 years ago

Also see #42

akhildasop commented 1 year ago

hai @actual-saurabh,

worked with '"after_clone" and "before_append" events. but still we didnt received the desired namings.

how to get the serialized index in clone ?