Forum Discussion

BrandonClark's avatar
BrandonClark
Qrew Cadet
5 years ago

Using iol to Select Tab of Child After Adding Child Record

I am trying to move my Add Child buttons up out of the tabs and on to the main form.  To keep it from appearing awkward, I also would like to have the associated tab selected after adding the child record.  Due to lack of talent, I've taken a two step approach.  The first is the Add Child button now also sets fid_104 to the tab number of the associated child table prior to adding the record. 

The second part is to use iol to set the focus to the desired tab on reload.  I have just the basic iol setup and a codepage with the following which successfully changes the focus to tab 11 on reload:

$("#tab_t11_link a").click();

What I am would like to do is have it read in the value of  fid_104 as a variable, if it is not "0", then use the variable to set the appropriate tab focus and set the fid_104 to "0".  

Any help is appreciated.


------------------------------
Brandon Clark
------------------------------

14 Replies

  • Post your formula for the Add Child buttons, you should be using the native & "&z=" & Rurl() and it should return to the correct tab after adding a child record. 

    ------------------------------
    Everett Patterson
    ------------------------------
    • BrandonClark's avatar
      BrandonClark
      Qrew Cadet
      Thanks for the reply Everett.  Code from button below. 

      The issue is that the button to add the child record is not on the child record tab for us.  It basically saves the user from having to click the tab header and then click add child.  This way they just click add child and then when completed it returns them with the correct tab in focus so they can see it come through and review/edit if required.  

      URLRoot() & "db/" & [_DBID_CONTACTS] & "?a=API_EditRecord&rid=" & URLEncode ([Record ID#])
      & "&_fid_104=11"
      & "&rdr="
      & URLEncode(URLRoot() & "db/" & [_DBID_OPPORTUNITIES] & "?a=API_GenAddRecordForm&_fid_17=" & URLEncode ([Related Company])& " &_fid_43=" & URLEncode ([Record ID#])& "&z=" & Rurl())

      ------------------------------
      Brandon Clark
      ------------------------------
      • EverettPatterso's avatar
        EverettPatterso
        Qrew Captain
        Sorry I must have misunderstood, you are wanting a function within the code page that looks at the value of _fid_104 and determines which tab to focus?

        (function () {
        //Get the expected tab value
        var QBUmytab = Number($("#tdf_1").text());
        //Go to tab based on value
        switch(QBUmytab) {
            case 3:
        		$("#tab_t3_link a").click();
        		break;
            case 4:
        		$("#tab_t4_link a").click();
        		break;
        };})();


        ------------------------------
        Everett Patterson
        ------------------------------