Forum Discussion

KenCasser's avatar
KenCasser
Qrew Cadet
7 years ago

&rdr="" in JavaScript not working

Here is my JavaScript code:

var date = new Date();
var yr = date.toDateString().substr(-2);
var mo = date.getMonth()+1;
var d = date.getDate();

var b = kRid;

console.log(kRid);

var URLONE = document.location.href = "https://ME.quickbase.com/db/DBID?act=API_EditRecord&rid="+kRid+"&_fid_...; "+d+", "+yr+" &_fid_10=Changed Project";

var URLTWO = document.location.href="https://ME.quickbase.com/db/DBID?a=er&rid="+(b);

$URLONE

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

console.log(b-1);

If we forget about using var URLONE & var URLTWO and instead test each of these lines separately, they work.  Using the first line alone, it edits the current record, gives me the console.log(b-1) which is one number less than the current record number (just for testing), but after doing that it I get the Success message.  So I hit the 'back' button and I can see the current record has been edited.  Using the second line alone, it brings the current record into its Edit mode, and I also get the correct console.log(b-1) confirmation that my code has gone its full length.  But, when I try to run the two lines concurrently, it seems to skip the first line (ie it doesn't change the fields per my request) and only brings me to the edit screen for the current record.  And, it does not give me the console.lot(b-1) confirmation.  PS - using var b = kRid has been part of my testing.  It works whether I use kRid or b, but I haven't cleaned things up yet.

Please help.  I'm so close to my goal I can taste it.  Thank you!

18 Replies