Forum Discussion

MatthewScammel1's avatar
MatthewScammel1
Qrew Trainee
8 years ago

Is there anyway of adding a custom query string parameter after clicking the Save & Close button?

I would like to add a customer query string parameter after clicking the Save & Close button.
For example, https://blank.quickbase.com/db/dbid?a=er&rid=1<b>&customeQueryStringParam=customValue</b>
I'm aware of how to do this with a custom button, but for this case, I would like to do this after clicking QuickBase's button.
Thanks in advance!
  • Matt, can you explain the purpose of this request, ie what are you trying to accomplish here?
  • Thanks for the speedy response!
    I'm trying to pass in which tab the user was on when they clicked the Save & Close button, so I could use some jquery to "click" them back to that tab after they have saved and they are back in view mode.
  • You can include any query parameter you want in the URL so long as you do not conflict with  existing parameters - QuickBase will just ignore it. But you will have to arrange for script run in the page using an injection technique -  such as IOL -  that will read the URL parameter and synthesize a click on the appropriate tab. The relevant code to extract the query string parameter is this:

    var urlParams = new URLSearchParams(window.location.search);
    var customValue  = urlParams.get("customeQueryStringParam");
  • Thank you for your response. I'm able to set and get the query string param when creating a custom button because adding the query string is as easy as adding it to the URL in the formula field.
    The part I'm having trouble with is inside of my script (which is using the IOL technique), I'm unable to set a query string param that will show up in the URL once the page goes from Edit mode back to View (after clicking the Save & Close button).
  • Generally when you submit a page the server alone will control what page you redirect to so you have no control over that form of submission. However there is a crude form of redirection built into QuickBase forms that continues to work (I just manually tested it).

    If you sent these two hidden fields as follows when the page submits you will save the record and redirect to ibm.com (replace with your URL):
    $("input[name=RedirectURL]").val("http://www.ibm.com");
    $("input[name=rl]").val("");
    I don't often use this method as QuickBase could easily rework the form submission process and eventually they will. Try pasting the code into the console before putting it in a code page.
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      If it works that is the end of it so party on. However, you can probably accomplish the same result without passing custom query parameters. Just do everything in one single script and skip over the parameter passing.
  • AlexWilkinson's avatar
    AlexWilkinson
    Qrew Assistant Captain
    Another way to do this is to create a custom button "Save & same tab" which works like (and actually uses) the standard "Save & keep working" button except that it navigates back to the same tab. For details see this new post, which also includes a "Save & next tab" button.