Save New and Edit forms without closing

Hi ...

I am trying to keep a both the new and edit forms open without closing. I have tried the following code in a custom button, over-riding the existing save button, and using the fd.field('xxx').$on('change', xxx) parameter of a field. My preference is to use fd.field('xxx').$on('change', xxx).

The code below closes the form for me in SharePoint 2019 on-premise. None of these have worked with the code below.

The code that I found in the forum for this is:
fd.spSaved(function(res) {
res.RedirectUrl = null;
});

Any help is appreciated, Rhonda

Hello @rhonda,

How do you open the form: full screen, dialog, panel?

Do you mean you want to save the form when field value changes? I wouldn't suggest this approach.
What is your use case?

Hi,

I am opening the as a panel. The div class="ms-Panel" on viewing the page source. I did not change any of the default settings for making the form a dialog or full screen form after installing Plumsail and creating the form with the designer.

Thanks, Rhonda

@rhonda,

You can keep the panel opened after saving the SharePoint item using the code:

//prevent form panel from closing
fd.spSaved(function(result) {
    result.KeepPanelOpened = true;
});

Hello --- this is not keeping my panel open. I added an alert to show me the value of result.KeepPanelOpened, and the value is true.

There are no errors in the console. There is no other code in spSaved.

fd.spSaved(function(result) {
result.KeepPanelOpened = true;
});

Here is my scenario:

I have a parent form with a DataTable (childA list). ChildA form has a DataTable (ChildBList).

When there is a brand new entry:

  1. New Parent Form. I need to save the form so that I have the ID.
  2. Leave Parent Form open so that I can save the ID to a lookup field in parent form used in the DataTable for the proper connection to that data.
  3. Create a NEW entry on the DataTable(ChildA); I need to save the form so that I have the ID.
  4. Leave this new entry open to save ChildA's ID to a lookup field that is used in its own DataTable.
  5. Create a NEW entry on the DataTable (ChildB).
  6. Save and close ChildB form.

All forms are panels.

I did try a redirect to the entry form for the parent form in spSaved. The result.RedirectURL did not work either. Again, no errors. All panels close when I click the Save button regardless of what code is in spSaved.

Any assistance is appreciated.
Rhonda

@rhonda,

If you want to redirect users to Edit Form and keep panel open, you can use this code for this:

fd.spSaved(function(result) {
    var listId = fd.spFormCtx.ListAttributes.Id;
    var itemId = result.Id;
    if (fd.isPanel) {
        const formCommands = new window.Plumsail.FormCommands({
            webUrl: fd._formManager._webUrl,
            listId: listId,
            listUrl: fd._formManager._listUrl,
            culture: _spPageContextInfo.currentUICultureName,
            language: _spPageContextInfo.currentLanguage,
            componentLoader: window._spComponentLoader
        });
        formCommands.load().then(function() {
            formCommands._openPanel({
                itemId: itemId,
                contentTypeId: fd.contentTypeId,
                formType: "Edit",
                rootFolder: fd.rootFolder
            });
        });
        //close original panel
        fd.close();
        }
});

Do you mean List or Library control? The form for the control opens in a dialog, not in the panel. To open the Edit from in a dialog after creating a new item you can add this code:

fd.control('SPDataTable1').$on('change', function(changeData) {
    if (changeData.type === 'add') {
        //Update the link to the form before texting
        Dialog.open("http://domain.Name/sites/SiteName/SitePages/PlumsailForms/ListName/Item/EditForm.aspx?item=" + changeData.itemId, { }, { }, { width: 600, height: 800 });
    }
});

Hello. I was able to utilize the first set of code. However, the second set did not work for me. I am creating a new LIST (not library item), but this didn't work.

fd.control('SPDataTable1').$on('change', function(changeData) {
if (changeData.type === 'add') {
//Update the link to the form before texting
Dialog.open("http://domain.Name/sites/SiteName/SitePages/PlumsailForms/ListName/Item/EditForm.aspx?item=" + changeData.itemId, { }, { }, { width: 600, height: 800 });
}
});

@rhonda,

Have you updated the link in the code?

You must replace this URL with the URL to the Edit form in the source list:

http://domain.Name/sites/SiteName/SitePages/PlumsailForms/ListName/Item/EditForm.aspx?item=

You can find it when opening the form in a full screen:

Hello, yes, of course, I modified the link you included with my link.

thanks, Rhonda

@rhonda,

What version of the designer are you using? Please share the screenshot.

Also, please share the screenshot of all errors/messages from the browser console after creating the new item using List or Library control. There must be a message indicating why the dialog can't be opened.

Hi there... I am using the 1.9.0 version of designer.

What do you need to see in the screenshot?

Thanks, Rhonda

@rhonda,

I need to see the browser console with all messages when you create an item via List or Library control. If possible, please record the video.

Also, please share the code you are using. You can export the form and share it here.