Redirect from NewForm to EditForm in DFFS

Change log
September 23, 2016
I had forgot to add “return false” in the PreSaveAction function – this could result in duplicates being added to the list.
January 05, 2016
Changed the code example to include the “InDlg” attribute if you are in a dialog.

Here is an alternative solution for redirecting from NewForm to EditForm when using DFFS.

This solution is based on entering NewForm, filling in the Title field, and hitting “Save” to continue in EditForm.

Here is an example on a NewForm


Add this code to the Custom JS

function saveAndRedir(){
	var ok = spjs.dffs.check_Mandatory(["Title"]), data = {}, newItem, url;
		data.Title = getFieldValue("Title");
		newItem = spjs.utility.addItem({"listName":_spPageContextInfo.pageListId,"data":data});
			url = location.pathname.substring(0,location.pathname.lastIndexOf("/")) + "/EditForm.aspx?ID=";
				url += "&IsDlg=1";
			location.href = url;

function PreSaveAction(){
	return false;

This is it – test it and let me know how it works out  in the Forum.

Best regards,

16 thoughts on “Redirect from NewForm to EditForm in DFFS”

  1. Seems to work brilliantly! 😀
    Are you auto-saving before the actual manual save to get the ID (if I’m reading the code correctly)? Does the auto-save trigger new item workflows associate with the list?
    Also in the example how are you display that message?
    “You must hit “Save” to continue filling in this item”
    I tried putting it in a rule but it puts the message on top.


  2. Alexander,

    I have implemented your code on small NewForm.aspx with about 6 fields. When the code executes, it only saves the Title field. I am having a hard time to figure out how to have it save all 6 fields before it moves on to the EditForm.aspx page. Any thoughts?

    Thank you!

    1. You would get a save conflict when trying to save the original form if you used code to update it and did not refresh the form.

      If you however update the form with code, and do a refresh, you would be OK.


  3. I also am trying to modify this solution to pass more than just the title field, but continue to get a webpage error upon submit ‘One or more field types are not installed properly. go to the list settings page to delete these fields.’ This error is received after trying to implement your solution of adding additional code: data.Title = getFieldValue(“Title”); My assumption is that is has something to do with the object/array creation.

    Can you please provide a more robust example of what the code would look like to pass multiple values from one form to another?

    1. Currently not – other than use the same approach as here and updating the list item with code instead of saving normally, but this will be tricky in large forms as you must collect all changed values and format them correct based on the column type.

      I’m on the look for a good redirect method in SP2013, but still have not been able to figure this one out.


  4. Works great except for a date field. I receive the following error when adding a Date field to the code:

    Invalid Date/time value.

    A date/time field contains invalide data. Please check the value and try again.

    The field is configured as a Date only field with no further validation rules.

  5. Hi there

    When trying this new method, I end up with the left hand navigation included as part of the modal dialog for the display form. Any ideas what I have done wrong?



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.