Auto Save

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
tbshelpdesk
Posts: 3
Joined: Thu Jul 20, 2017

20 Jul 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);

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

21 Jul 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.
Cheers

tbshelpdesk
Posts: 3
Joined: Thu Jul 20, 2017

21 Jul 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.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

24 Jul 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.
Cheers

tbshelpdesk
Posts: 3
Joined: Thu Jul 20, 2017

24 Jul 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?

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

24 Jul 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.
Here you can read about how it can be done - https://spform.com/buttons/open-edit-fo ... sharepoint
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests