Forum Discussion

BlakeEstep's avatar
BlakeEstep
Qrew Trainee
5 years ago

Redirect URL is not redirecting

I have a form with a button that, when clicked, pulls up an HTML code page. Within that code page, there are forms for the user to fill out. All that is working.
What I am having trouble with is the redirect URL. There is a button within the code page that submits the data to a child table (URLONE) and redirects to the Record ID in edit record mode (URLTWO). Separately they work but when trying to run both together I get the XML page saying there are no errors (see code below).
note: I have tried &NextURL= as well as &rdr= both result in the same XML page. 

var apptoken = "apptoken";
var dbid = "appid"; //app id
var dbidTable = "tableid"; // table id
var recordID = getQueryVariable("recID");
var URLroot = "https://web.quickbase.com/db/";

var URLONE = URLroot + dbidTable
+ "?act=API_addRecord"
+ "&_fid_10=" + recordID
+ "&_fid_11=" + productNumber
+ "&_fid_9=" + rollerValue + "&apptoken=" + apptoken; 

var URLTWO = URLroot + "bp9khqnah" + "?a=er&rid=" + recordID + "&apptoken=" + apptoken;

location.href =  URLONE + "&rdr=" + URLTWO;

After submitting I get this:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<qdbapi>
<action>API_addRecord</action>
<errcode>0</errcode>
<errtext>No error</errtext>
<rid>19</rid>
<update_id>1579884810872</update_id>
</qdbapi>

1 Reply

  • Solved!
    Have to encode the second URL but the QuickBase function URLEncode() won't work in javascript so I had to use a javascript based encoder. New code is:
    var URLONE = URLroot + dbidTable
    + "?act=API_addRecord"
    + "&_fid_10=" + recordID
    + "&_fid_11=" + productNumber
    + "&_fid_9=" + rollerValue + "&apptoken=" + apptoken;
    
    var URLTWO = "&rdr=" + encodeURIComponent(URLroot + "bp9khqnah" + "?a=er&rid=" + recordID);
    
    location.href = URLONE + URLTWO;​

    This code works and takes me back to the correct edit record form.