Redirect to EditForm from NewForm in dialog

Is it possible when saving a new form in dialog to redirect to the edit form in dialog? I used to be able to do this with the command but somewhere along the line it started giving me a map error when trying to save and the page locks up, even if I hit close the page is locked. Using the result.RedirectUrl does not do anything and does not pass an error in the console log so I assume this is due to the dialog.

Here is my code:

> fd.spSaved(function(result) {
>     //var listId = fd.spFormCtx.ListAttributes.Id;
>     var itemId = result.Id;
>     var scrWidth = Number(screen.width) * .75
>     var scrHeight = Number(screen.height) * .75
>     //replace "" with path to your site
>     //PageType=6 means Edit Form
>"" + itemId, { }, { }, { width: scrWidth, height: scrHeight });
> });

Hello @cwalter2,

How do you open a form in a dialog? Do you open it from the List or Library control?

Yes, I open the NewForm in Dialog from a List or Library Control.


You can try out this code on the parent form to open the dialog when a new item is created:

fd.control('SPDataTable1').$on('change', function(changeData) {
    if (changeData.type === 'add') {"" + changeData.itemId.ID, { }, { }, { width: 400, height: 400 });

I had to modify the code slightly:
+ changeData.itemId, { }, ....
I am getting the following error in console:

Everything appears to be operating correctly but I have not been able to extensively test.


This error is not related to the code I've shared.

Why you've had to modify the code? Were you getting errors when using changeData.itemId.ID?

It did not work using changeData.itemId.ID