Sending Variables with HTML

  • 0
  • 1
  • Question
  • Updated 6 months ago
  • Answered
The title is not quite accurate. I am trying to use the RID and other informatation from a record in an HTML page off a Formula URL button on the same record form. 

var number RID = [Record ID#];
var date PolEffDate = [Pol Eff Date];
var text DOT = [DOT Number];

"https://user.quickbase.com/db/DBID?a=dbpage&pagename=InvoicePDF.html?rid="&[Record ID#]

I obviously know that HTML cannot handle these variables. Is there anyway to get access to the RID from a button click into an HTML page? I will be using JS and Jquery once I have access to the RID. I am only trying to do this so I can have a custom HTML page that will then run the code. Any help is appreciated!
Photo of William Marrone

William Marrone

  • 310 Points 250 badge 2x thumb

Posted 6 months ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 27,884 Points 20k badge 2x thumb
Within the code page use this script 
var urlParams = new URLSearchParams(window.location.search);
urlParams.get("a"); // "dbpage"
urlParams.get("pagename"); // "InvoicePDF.html"
urlParams.get("rid"); // value of [Record ID#]
You used to have to use a library to parse the query string but now we have URLSearchParams native in JavaScript.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 27,884 Points 20k badge 2x thumb
BTW, you have a typo in your URL formula - should be:

"https://user.quickbase.com/db/DBID?a=dbpage&pagename=InvoicePDF.html&rid="; & [Record ID#]

VERY STRANGE - The Forum is messing up my correction by adding a semicolon. You have a question mark instead of an ampersand in your original formula before "rid="
(Edited)
Photo of William Marrone

William Marrone

  • 310 Points 250 badge 2x thumb
The issue I have when using the above url is that it will link to a page that doesn't exist. It will take the RID and use it as a part of the redirect and so it will not link properly.
Photo of William Marrone

William Marrone

  • 310 Points 250 badge 2x thumb
Never mind I saw the correction and now it works! Thanks Dan!