Redirect to display view

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
james.martin
Posts: 10
Joined: Mon Sep 25, 2017

28 Sep 2017

Yep! It saves fine without the code.

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

28 Sep 2017

Okay, is there anything in the console after redirection? If you include the code, does the console give you any errors?

Also, please send a full screenshot of your JavaScript editor, so the last part of the code is also visible. You can change size of the JavaScript editor just like other windows.
Cheers

james.martin
Posts: 10
Joined: Mon Sep 25, 2017

28 Sep 2017

Nope, there is nothing. Here is the screenshot:
2017-09-28_13-16-11.png
2017-09-28_13-16-11.png (147.18 KiB) Viewed 1303 times

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

29 Sep 2017

Alright, let's try something else. Try running this code from JavaScript editor and tell me if you get the result:

Code: Select all

fd.onsubmit(function (){
    $("#aspnetForm").attr('action',location.pathname.replace('Edit', 'Display') + '?ID=' + fd.getUrlParam(window.location.href, 'ID'));
    return true;
});
This will only work for Edit Form! For the New Form, you'll need to use the previous one.
Cheers

james.martin
Posts: 10
Joined: Mon Sep 25, 2017

02 Oct 2017

That worked!! Thanks!

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

02 Oct 2017

Excellent! Glad to have helped!
Cheers

james.martin
Posts: 10
Joined: Mon Sep 25, 2017

02 Oct 2017

Ugh, I spoke to soon. I just realized that when you click save, it redirects to the display form, BUT it doesn't save any of the changes made...

james.martin
Posts: 10
Joined: Mon Sep 25, 2017

02 Oct 2017

Ok, so I started searching again and I found the following which seems to work:

Code: Select all

fd.onsubmit(function() {
fd.sourceFormParam('fd_Item_DisplayForm.aspx?ID=' + GetUrlKeyValue('ID'));
return true;
});

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

03 Oct 2017

Hello, James!
Okay, glad it works now! And thank you for testing this, it'll be very useful in the future. Sorry for all the delay!
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests