How to pass a value through the url into an "er" form?

  • 0
  • 2
  • Question
  • Updated 3 years ago
  • Answered

I have the following url:


https://fixandpaint.quickbase.com/db/bkartv27c?a=er&rid=1869&dfid=18&_fid_391=289&xx=34


I want the contents of fid_391 to show 289.  Unfortunately, when the form loads, it appears to be pulling the data from the table for rid=1869, but not applying what I tried to pass in ("289").


I am using an IOL process because after the save I have some activity, so if anyone knows how in javascript onLoad (or any other way) to get this data into the field, I would be very appreciative.


Thanks,

Dean

Photo of Dean

Dean

  • 708 Points 500 badge 2x thumb

Posted 3 years ago

  • 0
  • 2
yes, the a=er is not an API and it does not let you pass values into fid's.

A low tech solution could be this

var URLONE = https://fixandpaint.quickbase.com/db/bkartv27c?act=API_EditRecord&rid=1869&_fid_391=289;
var text URLTWO = https://fixandpaint.quickbase.com/db/bkartv27c?a=er&rid=1869&dfid=18;

$URLONE
& "&rdr=" & URLEncode($URLTWO)

(I don't know what the &xx=34 was doing so I left it out)
Photo of Dean

Dean

  • 708 Points 500 badge 2x thumb
I figured out a solution based on other feedback outside this forum.  I put the following in my script:



var varInputFields=window.location.search.substr(1);

var varArray=varInputFields.split("&");

var AssignedTask=varArray[3].split("=")[1];

This pulled the 4th variable from the input string and put it in the new variable AssignedTask.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
You can't rely on a query parameter being in a specific position within the query string and there are cases in which the query parameter may be url encoded. So it is better to use a tested function or a library to perform the parsing. There are 100s of these available. Here is one from stackoverflow:

http://stackoverflow.com/questions/2090551/parse-query-string-in-javascript#answer-2091331
Photo of Dean

Dean

  • 708 Points 500 badge 2x thumb
Thanks Dan.  I added this to my process.  Great suggestion.