Auto Save
-
- Posts: 3
- Joined: Thu Jul 20, 2017
I have a form for a parent list, I have a related item list in the form as well.
Everything is working, even totals!
My only issue now, when I create a new parent item, and I start adding child items.... if I were to close out.... the parent item would be lost and the child items would be in limbo.
How can I auto save the parent when adding child objects. Below is my javascript used to display related items and to get a total.
fd.populateFieldsInGrid($('.orderlist-item'), {
OrderList: '{CurrentItem}'
});
var total = 0;
var rows = fd.relatedItems(0).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Total'])
});
fd.field('Total').value(total);
Everything is working, even totals!
My only issue now, when I create a new parent item, and I start adding child items.... if I were to close out.... the parent item would be lost and the child items would be in limbo.
How can I auto save the parent when adding child objects. Below is my javascript used to display related items and to get a total.
fd.populateFieldsInGrid($('.orderlist-item'), {
OrderList: '{CurrentItem}'
});
var total = 0;
var rows = fd.relatedItems(0).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Total'])
});
fd.field('Total').value(total);
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello!
Unfortunately, it is almost impossible to implement JS code which will do it on the New Form, but there is a workaround that we can offer.This functionality that you want is available on the Edit form, since the item has already been saved and unless the item is later deleted, children will remain binded to it.
So, you can simply remove Related Items field from your New Form and instead, redirect users straight to the Edit Form once the New Form has been saved. Here you can read about how it can be done - https://spform.com/buttons/open-edit-fo ... sharepoint
In the newly opened Edit Form, users can add new items and even close the form, without being worried that items will remain without a parent.
Unfortunately, it is almost impossible to implement JS code which will do it on the New Form, but there is a workaround that we can offer.This functionality that you want is available on the Edit form, since the item has already been saved and unless the item is later deleted, children will remain binded to it.
So, you can simply remove Related Items field from your New Form and instead, redirect users straight to the Edit Form once the New Form has been saved. Here you can read about how it can be done - https://spform.com/buttons/open-edit-fo ... sharepoint
In the newly opened Edit Form, users can add new items and even close the form, without being worried that items will remain without a parent.
Cheers
-
- Posts: 3
- Joined: Thu Jul 20, 2017
How about making the parent form, child form create temporary ID's. once the Save button is clicked, they then move to permanent IDs. This would prevent a user from entering a child item and hitting cancel losing their items before pressing save.
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
That is what it does by default. The problem is, if the parent creation is not complete, this temporary ID no longer points to an item, but the Children are already created. So you get stuck with Children without the Parent.
If the parent was already created then the Children are automatically binded to it, without the need for temporary ID.
If the parent was already created then the Children are automatically binded to it, without the need for temporary ID.
Cheers
-
- Posts: 3
- Joined: Thu Jul 20, 2017
is it possible to initiate a save in the background without closing the window..........but keep it so it I press the button save, it closes out?
my calculated total is changing... so what I could do I say if the total changes, trigger the item to save in the background ? That way it implies an item has been added?
my calculated total is changing... so what I could do I say if the total changes, trigger the item to save in the background ? That way it implies an item has been added?
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
You cannot stay in the New Form after saving the item. But you can open the Edit Form of the same item right after saving though.
Instruction on how to do it is in my first reply.
Instruction on how to do it is in my first reply.
Here you can read about how it can be done - https://spform.com/buttons/open-edit-fo ... sharepoint
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests