Forum Discussion
MarkShnier__You
Qrew Legend
6 years agoYou can do this with a Formula Rich text field,
var text ToggleApproval =
URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_28=" & not [checkbox];
// note that you already have a formula URL field so you can just use this instead of the above line
var text ToggleApproval = [my existing URL formula field];
var text URL =
"javascript:" &
"$.get('" &
$ToggleApproval &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);";
If([checkbox]=true,
"<a class=\"Vibrant Danger\"a href=" & $URL & ">" & "Click to reverse Approval" & "</a>",
"<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'" & "a href=" & $URL & ">Click to Approve</a>")
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------
var text ToggleApproval =
URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_28=" & not [checkbox];
// note that you already have a formula URL field so you can just use this instead of the above line
var text ToggleApproval = [my existing URL formula field];
var text URL =
"javascript:" &
"$.get('" &
$ToggleApproval &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);";
If([checkbox]=true,
"<a class=\"Vibrant Danger\"a href=" & $URL & ">" & "Click to reverse Approval" & "</a>",
"<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'" & "a href=" & $URL & ">Click to Approve</a>")
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------
- ChrisFaye16 years agoQrew CadetThank You, Mark! As always you're amazing!
So would I'd be adding it into the formula button, right?
Here's the current formula. Sorry I'm a little turned around on where to splice in the If statement.
// edit the record: fid 109 to [Approved By] - Stamp application with approver name and date/time
var text URLONE = URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_236=" & URLEncode(UserToName(User()))
& "&_fid_237=true"
& "&apptoken=.....";
//Display Current Record
var text DisplayRecord=
URLRoot() & "db/" & Dbid()
& "?a=dr&rid=" & [Record ID#]
& "&apptoken=.....";
//String, Edit and Display Current Original Record
$URLONE
& "&rdr=" & URLEncode($DisplayRecord)
------------------------------
Chris
------------------------------- MarkShnier__You6 years ago
Qrew Legend
OK, it is helpful to see your code
Try this
// edit the record: fid 109 to [Approved By] - Stamp application with approver name and date/time
var text URLONE = URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_236=" & URLEncode(UserToName(User()))
& "&_fid_237=true"
& "&apptoken=.....";
var text URL =
"javascript:" &
"$.get('" &
$URLONE &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);";
If([checkbox]=true,
"<a class='Vibrant Danger'>Approved</a>",
"<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'" & "a href=" & $URL & ">Click to Approve</a>")
You can also substitute 'Vibrant Primary' for 'Vibrant Danger' if you want the button to be blue instead of red when approved. Or 'Vibrant Alert" for a yellow color.
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------- ChrisFaye16 years agoQrew CadetThank You, Mark!
I just plugged it in and the button itself isn't responding to the formatting. Could it be something to do with the field display settings? I'm playing around with them, but not finding anything that works. (Getting no button/only link or the button with the field settings color, etc.)
Here's a screenshot of the field settings.
------------------------------
Chris
------------------------------