Tabs in Dynamic Forms (Remembering last tab)

Home Forums General discussion Tabs in Dynamic Forms (Remembering last tab)

Viewing 4 reply threads
  • Author
    Posts
    • #11458
      Naomi R Mena
      Participant

        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!

      • #11526
        Alexander Bautz
        Keymaster

          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

        • #11666
          Naomi R Mena
          Participant

            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;
            }

          • #11689
            Kasey
            Participant

              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.

            • #11716
              Alexander Bautz
              Keymaster

                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

            Viewing 4 reply threads
            • You must be logged in to reply to this topic.