Page 1 of 1

Cancel Button Redirect Source

Posted: 30 Jan 2019
by fishvict
Greetings,
I currently have a document set where I've put a button to the Edit Form of an item in a list. That part works great. However, when i get to the form, if I click "cancel", I get an error.

Error: "Sorry, something went wrong... an unexpected error has occurred"

Looking at the URL, it seems that the source is getting cut off.
To get back to the document set, I need the RootFolder to appear in the Source parameter. However, it doesn't show up. This is what I see:
https://<SPONLINE.com>/sites/DEVPIPCopy/PIPPRDPIPProjectDocuments/Forms/PIPDocSet/docsethomepage.aspx?ID=83

In my cancel button, I've put some code:
var theURLParam = fd.getUrlParam(window.location.href, 'Source');
var theRootFolder = fd.getUrlParam(window.location.href, 'RootFolder');
var theURI = theURLParam+'&RootFolder='+theRootFolder;
alert(theURI);

fd.sourceFormParam(theURI);
var theSourceForm = fd.sourceFormParam();
alert(theSourceForm);

via the alert(theSourceForm); I can confirm that the URI is correct. It contains the complete source needed, but it eventually returns to the error page.
I don't see anything of interest in the DEV console.

If I put the full URL for this particular docset into the "redirect after cancellation URL:", it works fine.
https://<SPONLINE.COM>/sites/DEVPIPCopy/PIPPRDPIPProjectDocuments/Forms/PIPDocSet/docsethomepage.aspx?ID=83&RootFolder=/sites/DEVPIPCopy/PIPPRDPIPProjectDocuments/PIP18

Hoping I just missed something silly.

Thanks!
Victor

Re: Cancel Button Redirect Source

Posted: 31 Jan 2019
by AlexZver
Dear Victor,

I'm sorry, I can't reproduce your issue, could you please provide temporary access in the private message?

You can either share a site with an external user (azverev@180821.onmicrosoft.com): https://docs.microsoft.com/en-us/sharep ... g-overview
 
Or provide credentials of one of the existing users - then you can change the password.

Re: Cancel Button Redirect Source

Posted: 31 Jan 2019
by fishvict
I've sent you a sharing link. Thanks for taking a look. Its a development site, so no worries about poking around.
Sincerely,
Victor Fisher

Re: Cancel Button Redirect Source

Posted: 31 Jan 2019
by AlexZver
Dear Victor,

As far as I see, your final link is https://<SPONLINE.COM>/sites/DEVPIPCopy/PIPPRDPIPProjectDocuments/Forms/PIPDocSet/docsethomepage.aspx?ID=83

You need to add a RootFolder and List parameters to successfully redirect.

Re: Cancel Button Redirect Source

Posted: 01 Feb 2019
by fishvict
I did do that, but the form seems to be ignoring it...
I put this code into the Cancel button (as noted above). See my notes in bold, below.
Should i be putting the code elsewhere?

In my cancel button, I've put some code:
var theURLParam = fd.getUrlParam(window.location.href, 'Source');
var theRootFolder = fd.getUrlParam(window.location.href, 'RootFolder');
var theURI = theURLParam+'&RootFolder='+theRootFolder; <-- right here I create the new URI
alert(theURI);

fd.sourceFormParam(theURI); <-- right here I set it
var theSourceForm = fd.sourceFormParam(); <-- right here I check the URI (doc says that if call this without params, it brings back the current stting)
alert(theSourceForm);

thanks,
Victor

Re: Cancel Button Redirect Source

Posted: 04 Feb 2019
by AlexZver
Dear Victor,

Is the issue still actual? I've visited your site to research the issue and noticed that you've changed your implementation.

Re: Cancel Button Redirect Source

Posted: 05 Feb 2019
by fishvict
Well, I haven't stopped what other development I can do (as this project is getting close to overdue) but I have not touched neither the form nor the record (83) for testing this issue. The issue still does exist.

Re: Cancel Button Redirect Source

Posted: 05 Feb 2019
by AlexZver
Dear Victor,

Yes, I'm sorry, I've visited the wrong List. We are researching your issue.

Re: Cancel Button Redirect Source

Posted: 07 Feb 2019
by AlexZver
Dear Victor,

The issue is that the Source parameter in the "Edit Request" is not encoded. It contains "&" which are not encoded, so it's not clear if the remaining params belong to the Source or to the Form URL.

This is the right link to the form, you can check it: https://gsiccorp.sharepoint.com/sites/D ... %252FPIP18

Re: Cancel Button Redirect Source

Posted: 07 Feb 2019
by fishvict
AHHH! thank you! I knew it was something I was missing. This is what I get for deciding to do coding again after 15 years of not doing it.

I appreciate you looking into this. We love the tool here... its getting used quite a bit now that we're moving from On-Prem to Online.

thanks again.