IvanWeiss
5 years agoQrew Captain
Rich Text Field Showing Javascript Code
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
------------------------------
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
------------------------------