awesome_nested_fields
awesome_nested_fields copied to clipboard
Only 2 items get inserted while inserting 4
I have downloaded and ran the demo of multi_level.
When I insert a task with 4 resources like this:
If I then click save I see this:
So only the first and last resource get created.
BTW I noticed this in the docs:
new_item_index: 'new_resource_index' // Same used on view options
but in the view there is
<%= f.nested_fields_for :resources, new_item_index: 'new_resource_item', html: { class: "resource-form" } do |f| %>
Is that correct? So new_resource_index != new_resource_item
Maybe that has something to do with it.
I think this project is out of date. I'm updating it now.
Hi lailsonbm,
This is the project I'm talking about where it's only inserting the last and first item. Should I create an issue there or do you think it's in the code of the gem?
I'm seeing a problem similar to this as well.
Im creating X number of nested forms using this JS function.
element.nestedFields('insert', function(item) { // Make some operation with item }, {skipBefore: true});
The correct number of extra forms are shown in the clientside, but when I submit the form, only some of the records are actually saved.
If I create each field manually using a "+ Add Phone" trigger button it seems to work OK
But for example if I create 10 extra fields via the insert JS function and pre-fill the values in them using JS, only a few of them will actually save, commonly around 4 or 5.
If you need help recreating this I can give you more detail. I'm not sure where to start on debugging this as I can't lock down the exact criteria of the bug, I think it's related to creating multiple fields at once using the insert function.
thanks for your help. George