Discussions

Expand all | Collapse all

Save and next tab button

  • 1.  Save and next tab button

    Posted 12-20-2019 08:54
    Edited by Mike Klausing 12-20-2019 08:54
    I used to have a save and next button that would move the user to the next tab on my form.  It no longer works and i've tried to look at the new posts about what changed but it still doesnt work.  Here is what I have done

    SaveAndNextTab.js
    var nextTabLink=$("li.ui-tabs-active").next("[style!='display:none']").children("a");
    $("#saveAndKeepWorkingMenuOption").click();
    $(nextTabLink).click();
    location.assign('#navTop');

     customButtonScript1
    <a href='javascript:($.getScript("https://xxxx.quickbase.com/db/bpgjc56je?a=dbpage&pagename>

    customButtonScript2
    "));void(0);


    button: 

    [customButtonScript1]
    & "SaveAndNextTab.js"
    & [customButtonScript2]
    & "' class='Vibrant' style='color:white; background:#427cd8; white-space:nowrap;'>Next</a>"

    ------------------------------
    Mike Klausing
    ------------------------------


  • 2.  RE: Save and next tab button

    Posted 12-26-2019 11:23
    Edited by Evan Westbrook 12-26-2019 11:31
    Mike,

    I was able to adjust your provided code to make a working feature with a Rich Text field. Here's the working code:
    var text customButtonScriptOne = "<a href=javascript:$.getScript('https://YOURREALM.quickbase.com/db/YOURDBID?a=dbpage&pagename=";
    var text customButtonScriptTwo = "');void(0);";
    
    $customButtonScriptOne
    & "SaveAndNextTab.js"
    & $customButtonScriptTwo
    &  " class='Vibrant' style='color:white; background:#427cd8; white-space:nowrap;'>Next</a>"
    Note, I had to switch some of the " to ' and vice versa for this to work in Rich Text. Syntactically, yours would have worked in a .js page.

    I can't speak as to why your code stopped working, but I was able to identify a few potential syntax errors. Updating these allowed the feature to work in my app.
    • No "=" after "pagename" (Line 1)
    • Extra anchor element closing bracket (Line 1)
    • No need to surround "javascript...void(0);" with single quotes. This may have caused some wires to get crossed when it comes to " or '
    • Potentially redundant () surrounding "javascript...void(0)"

    By the way, this button is a really cool feature. Thanks for sharing it here.

    Thanks,
    ------------------------------
    Evan Westbrook
    PRIME Developer
    Harder Mechanical Contractors Inc.
    Portland OR
    ------------------------------



  • 3.  RE: Save and next tab button

    Posted 12-26-2019 14:17
    Edited by Don Larson 12-26-2019 14:17
    Evan,

    Just to clarify,  you have the SaveAndNextTab.JS code saved as a page?

    Don

    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------



  • 4.  RE: Save and next tab button

    Posted 12-27-2019 10:11
    Don,

    Yes. SaveAndNextTab.js is a code page. I copy and pasted Mike's code for SaveAndNextTab.js directly.

    Thanks,

    ------------------------------
    Evan Westbrook
    PRIME Developer
    Harder Mechanical Contractors Inc.
    Portland OR
    ------------------------------



  • 5.  RE: Save and next tab button

    Posted 12-27-2019 09:31
    Evan, 

    I have been unable to get this working still. I am still supposed to be using the .js page right?

    No matter how I am putting in that code you gave me it is giving me syntax errors.

    ------------------------------
    Mike Klausing
    ------------------------------



  • 6.  RE: Save and next tab button

    Posted 12-27-2019 10:30
    Edited by Evan Westbrook 12-27-2019 10:31
    Mike,

    SaveAndNextTab.js is a code page. The rest of the code blurb is in a "Formula - Rich Text" field.

    Regarding debugging, try the following:

    • Make sure your field is "Formula - Rich Text."
      • In Rich Text, we're making a button using an anchor element instead of letting QuickBase do it for us through a URL field.
      • Your original syntax looks "Formula - URL"ish. That might result in a QuickBase syntax error.
    • Hover over the button in QuickBase and look at the bottom left corner of your browser window. This will give you a preview of the code that will execute on click
      • This is helpful verifying what QuickBase is actually making with the formula.
      • Make sure everything looks correct there. javascript execution in QuickBase is very strict when it comes to no spaces.
      • Correct Syntax Result
      • Incorrect Syntax Result (special character trimmed everything after "getScript(")
    • Open the developer tools of your browser (F12), access the Console, and watch it when you click the button. If there is a JavaScript error or something isn't working as expected, an error will often appear in the console log.
    If all else fails, could you attach a screenshot of the syntax error? Is it in the QuickBase field or the JavaScript page? I'm interested to see your solution. Maybe there's an App Setting I'm missing.

    Thanks,
    ------------------------------
    Evan Westbrook
    PRIME Developer
    Harder Mechanical Contractors Inc.
    Portland OR
    ------------------------------



  • 7.  RE: Save and next tab button

    Posted 12-27-2019 10:59

    This is what it gives me

     

     

    Thank you,
    Mike Klausing

     






  • 8.  RE: Save and next tab button

    Posted 12-27-2019 11:00
    This is what it gives me: 

    The error is a variable declaration must end with a semi colon.

    ------------------------------
    Mike Klausing
    ------------------------------



  • 9.  RE: Save and next tab button

    Posted 12-27-2019 11:13
    Mike you  have =") in the second line and you are missing the first single quote "')

    ------------------------------
    jason johnson
    ------------------------------



  • 10.  RE: Save and next tab button

    Posted 12-27-2019 12:19

    I have put the single quote back in and the error doesn't change.

     

    As far as I can see it's exactly the same otherwise.

     

     

     

    Thank you,
    Mike Klausing

     






  • 11.  RE: Save and next tab button

    Posted 12-27-2019 12:32
    Mike, 

    It looks like you are also missing your closing quote on ScriptOne and the single quote would need to be placed inside the double quote starting the ScriptTwo variable.

    ------------------------------
    Brandon Drake
    JHI Group
    Monroeville OH
    ------------------------------



  • 12.  RE: Save and next tab button

    Posted 12-27-2019 15:30
    Mike,

    As everyone has mentioned, It looks like you have some " and ' out of order or missing in Lines 1 and 2.

    Make sure to remove the ">" at the end of Line 1. Left in, it will effectively close the opening of the anchor element (the <a> thing) twice. For example, if we remove all parameters, your current formula would render:

    <a>>Next<a/>

    You want it to read:
    <a>Next<a/>


    ------------------------------
    Evan Westbrook
    PRIME Developer
    Harder Mechanical Contractors Inc.
    Portland OR
    ------------------------------