Home › Forums › General discussion › Tabs in Dynamic Forms (Remembering last tab)
- This topic has 4 replies, 3 voices, and was last updated 8 years, 6 months ago by Alexander Bautz.
-
AuthorPosts
-
-
May 10, 2016 at 23:25 #11458
With the tabs in Dynamic forms, is there a way to remember which tab was chosen last when entering a new item. Ex: Card, Home Loans, Deposits, when I click on new item I enter it from the Deposits tab. After I save the item, I created a loop to come back to the dialog box so that a new item can be created. However, the tab automatically defaults back to “Card” instead of remembering I was on the “Deposits” tab. Any suggestions? Thanks!
-
May 13, 2016 at 22:08 #11526
Hi,
The “Use cookie to remember selected tab” functionality in the Misc tab doesn’t currently apply to NewForm, but you can set your redirect url with the paramenter “sTab=[tabIndex]” – like this:/Lists/DFFS_TestList/NewForm.aspx?sTab=2
The current selected tab can be obtained from this variable:
spjs.dffs.data.selectedTab
Hope this helps,
Alexnader -
May 19, 2016 at 16:22 #11666
Hi Alex,
Thank you for response. Based on your suggestions we used the below JS code to input within dynamic forms. However, it still goes back to the first “Card” tab and does not stay on the tab we are currently using.
Any suggestions?
Thanks,function PreSaveAction(){
var URL = location.pathname.replace(‘NewForm.aspx’,’NewForm.aspx’);
var myTab = spjs.dffs.data.selectedTab;
if(GetUrlKeyValue(“IsDlg”)===”1″){
URL += “?sTab=” + myTab + “&IsDlg=1”;
}
$(“#aspnetForm”).attr(‘action’,location.pathname+”?Source=”+URL+”?sTab=”+myTab);
return true;
} -
May 20, 2016 at 00:47 #11689
Alex,
I was trying to help Naomi out and what she didn’t include in her last comment is that on save of a new item in full view the tab is remembered. When in dialog it is not. We looked at the properties of the new dialog after save and the sTab parameter was not passed as it should be. We tried to update the code to put the sTab parameter in front of the IsDLG parameter and that broke it completely and after save the user is taken to the default view instead of a new dialog. Hope these details help.
-
May 24, 2016 at 06:55 #11716
Hi,
Using the IsDlg=1 attribute will not actually redirect you to a new dialog – it is only a keyword for hiding all other things than the form when using a dialog. You can test this by modifying your URL to include this attribute in a non-dialog page.In case you want to use a “&” in an URL query string like this, you must escape it to “%26”.
Regarding the sTab attribute in the URL – you might need to escape the “?” in the sTab attribute like this:
$(“#aspnetForm”).attr("action",location.pathname+"?Source="+URL+"%3FsTab="+myTab);
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.