I've created a parent list (Vendors) and a child list (software list). There can be multiple vendors for one piece of software. I've created a custom new form with a link which opens up a modal to add a new vendor while filling out the Software form. I need it to save the vendor to the vendors list and then refresh the software form when the modal closes, but retain all the values they've already entered.
Seems like it should be a common request, and I've read several posts and suggestions on the subject already. I've gotten it to work with just a single lookup drop down...the problem comes when I switch it to a multiple lookup. It adds the item to the list, but then does not refresh the list on the form. There have been a couple of posts on technet about it:
but neither of these end with a proper resolution. Anyways, here's the code I have currently:
<a href="#" onclick="OpenVendor('/sites/ITSite/Lists/Vendors/NewForm.aspx');">Add new vendor</a>
And the javascript:
function OpenVendor(listUrl) {
var options = {
url: listUrl,
dialogReturnValueCallback: scallback
};
SP.UI.ModalDialog.showModalDialog(options);
}
function scallback(dialogResult, returnValue) {
if (dialogResult == SP.UI.DialogResult.OK) {
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
I've tried options.dialogReturnValueCallback = RefreshOnDialogClose
with the same results. The only thing that seems to work so far is location.reload(true)
but that refreshes the entire form and throws out all the entered fields.
I need to stick with javascript and can't load any outside add-ons in. JQuery is fine. Thanks in advance for any and all help.