Redirect on Save

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
TonyDuke
Posts: 71
Joined: Mon Sep 11, 2017

13 Feb 2018

Good Morning,

I am trying to add a function to a New and Edit Form so that on submit, based on certain conditions it will redirect on save to a specific New Form (from the same List)

My unconditional redirect code is as below: -

Code: Select all

fd.onsubmit(function() {
	fd.sourceFormParam('fd_Task_bb60fbb4-0754-4de2-bb50-1eb6565a2b1a_NewForm.aspx?');
	return true;
});
This works fine as long as I navigate directly to the initial New form, however we are encoding some data into the initial URL of the form to pass through data from a previous form and in doing so this seems to break the save function.

The initial clean URL looks like this: -

Code: Select all

https://xxxxxxxxxx.sharepoint.com/ERP/Lists/Sales%20Activities/fd_Task_bb60fbb4-0754-4de2-bb50-1eb6565a2b1a_NewForm.aspx?
The initial encoded URL like this: -

Code: Select all

https://xxxxxxxxxx.sharepoint.com/ERP/Lists/Sales%20Activities/fd_Task_bb60fbb4-0754-4de2-bb50-1eb6565a2b1a_NewForm.aspx?CompanyNameId=474&CompanyName=xxxxxxxx&ContactNameId=&AddressNameId=
When trying to save the form the item is saved to the list but with a number of fields blank and the New Form fails to open with the following error displayed: -
"Invalid data has been used to update the list item. The field you are trying to update may be read only. "

I'm sure its a fairly simple fix, but I just can't get my head around it...

Thanks

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

14 Feb 2018

Dear Tony,
If passing parameters in the URL breaks functionality of the new form, I would suggest to store the same data in localStorage instead, you can also use it to retrieve data when the form opens.
Cheers

User avatar
TonyDuke
Posts: 71
Joined: Mon Sep 11, 2017

14 Feb 2018

Thanks Nikita,

I have now started using sessionStorage and that is working 100%.

Thanks again for your assistance

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests