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;
});
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.
I have a parent form with a DataTable (childA list). ChildA form has a DataTable (ChildBList).
When there is a brand new entry:
New Parent Form. I need to save the form so that I have the ID.
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.
Create a NEW entry on the DataTable(ChildA); I need to save the form so that I have the ID.
Leave this new entry open to save ChildA's ID to a lookup field that is used in its own DataTable.
Create a NEW entry on the DataTable (ChildB).
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.
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.
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.