Skip to main content
Question

Rich Text Field Showing Javascript Code

  • December 30, 2020
  • 0 replies
  • 307 views

Forum|alt.badge.img+11
Hi everyone,

I have a rich text field with a button that "completes" a task.  It shows up in multiple places (including my dashboard reports) so I used javascript to return it to the current page.  Below is the code I used.  The problem I have is that it is showing the javascript on the button (see screenshot).  Any ideas on how to hide that?

//Button Functionality:
//
//Check the current Task Stage
//
//If not Complete display button as gray
//Code should change the Task status to Complete

var text CLASS = If([Status]="Complete","btn btn-primary btn -sm","btn btn-default btn -sm");
var text FONTCOLOR = If([Status]="Complete", "#FFFFFF", "#A9A9A9");
var text LABEL = "Complete";

//Change the Task Status to Complete
var text URLONE = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=HIDDEN" &
"&_fid_24=Complete" &
"&_fid_36=Changed Status to Complete" &
"&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid="& [Record ID#]);

//Create edit functionality
var text URL = "href='" & $URLONE & "'";

var text LINK = "<a class='" & $CLASS & "' style='color: " & $FONTCOLOR & "; text-decoration: none'" & $URL & ">" & $LABEL & "</a>";

"javascript:" &
"$.get('" &
$LINK &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"

------------------------------
Ivan Weiss
------------------------------

Forum|alt.badge.img+15
  • Registered
  • December 30, 2020
Ivan,

Give them an icon to look at 

var text IMG  =     "<img src=https://images.quickbase.com/si/48/016-email_0.png>"; 

 "<a href=\"javascript:" & "$.get('" & $URL  & "', function(){" & "location.reload();" & "});" & "void(0);\">"& $IMG &"</a>"


------------------------------
Don Larson
Paasporter
Westlake OH
------------------------------

BrianCafferelli
Forum|alt.badge.img+17
Hi Ivan,

Inserting Javscript into Quick Base formulas is an unsupported technique, and later this year we will begin blocking any new Javascript code from being added in this way. This is an important change to the platform as Quick Base was never designed for arbitrary code to be used in formulas, and it causes a lot of issues being able to support such apps and to pass them on to other admins in your company.

We're looking into improving our formula language to allow for reloading the page, but in the meantime we recommend copying your formula for each report/dashboard it appears on.

Thanks,
Brian

------------------------------
Brian Cafferelli
Product Marketing Manager | Quick Base
------------------------------