Open NewForm of another content type in dialog
Posted: 13 Nov 2018
Hi guys.
Here is my situation, with my custom list.
1. I open up a Display Form in the browser which is content type A (not dialog).
2. I click a custom button on the Display Form which opens a New Form (content type B) in a dialog.
The Custom Button on the Display Form of content type A has this:
-----------------------------------------------
var webUrl = _spPageContextInfo.webServerRelativeUrl;
//The path to content type B New form
var listNewForm = "/Lists/X/fd_B_000_NewForm.aspx";
// open target form
fd.openFormInDialog(webUrl + listNewForm);
-----------------------------------------------
My New Form opens correctly. But the funky thing is that when I save the New Form I am not creating a new item, I am overwriting the item which is open in the Display Form!
I noticed that when I view the properties of the New Form (dialog) the URL contains "&Source= theURL and ID of the item seen in Display form".
My question is: What js needs to be behind my custom button so that it defenitely opens up the NEW FORM of content type B and saves it as a new item?
Here is my situation, with my custom list.
1. I open up a Display Form in the browser which is content type A (not dialog).
2. I click a custom button on the Display Form which opens a New Form (content type B) in a dialog.
The Custom Button on the Display Form of content type A has this:
-----------------------------------------------
var webUrl = _spPageContextInfo.webServerRelativeUrl;
//The path to content type B New form
var listNewForm = "/Lists/X/fd_B_000_NewForm.aspx";
// open target form
fd.openFormInDialog(webUrl + listNewForm);
-----------------------------------------------
My New Form opens correctly. But the funky thing is that when I save the New Form I am not creating a new item, I am overwriting the item which is open in the Display Form!
I noticed that when I view the properties of the New Form (dialog) the URL contains "&Source= theURL and ID of the item seen in Display form".
My question is: What js needs to be behind my custom button so that it defenitely opens up the NEW FORM of content type B and saves it as a new item?