Open NewForm of another content type in dialog
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?
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Oz,
This is really strange, it shouldn't happen assuming the New Form has opened properly. We'll need to see the URL used in the dialog to say what's going on.
Could you please, find an iframe on the page where the dialog form is embedded (.ms-dlgContent -> .ms-dlgBorder -> .ms-dlgFrameContainer), and send us a screenshot, which includes both the URL of the opened page, and the URL used in dialog, like this:
This is really strange, it shouldn't happen assuming the New Form has opened properly. We'll need to see the URL used in the dialog to say what's going on.
Could you please, find an iframe on the page where the dialog form is embedded (.ms-dlgContent -> .ms-dlgBorder -> .ms-dlgFrameContainer), and send us a screenshot, which includes both the URL of the opened page, and the URL used in dialog, like this:
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Oz,
Sorry for the delay. From the screenshot, it seems like you are actually opening New Form of the same list with the same Content Type, just a different form set, and when you do this, the ID is also passed with the use fd.openFormInDialog()
We've tested this scenario, and to avoid this, we recommend to use the following for opening form in dialog:
Sorry for the delay. From the screenshot, it seems like you are actually opening New Form of the same list with the same Content Type, just a different form set, and when you do this, the ID is also passed with the use fd.openFormInDialog()
We've tested this scenario, and to avoid this, we recommend to use the following for opening form in dialog:
Code: Select all
fd.openFormInDialog(webUrl + listNewForm, {ID:null});
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Oz,
You are very much welcome! It did takes us some time to figure out and test, so, sorry for the delay, but if you need anything - just let us know, we're sure to help!
You are very much welcome! It did takes us some time to figure out and test, so, sorry for the delay, but if you need anything - just let us know, we're sure to help!
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 22 guests