Skip to main content
Question

URL Button to check/uncheck a check box

  • May 24, 2017
  • 0 replies
  • 55 views

Is it possible to use conditional logic with an api call? I would like to create a URL button to check or un-check a checkbox depending on the state it is in 

  • Quickbase Alumni
  • May 24, 2017
Hi Jorden,

Yes, you can.

Please have a look at the sample formula:

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]   & If([Checkbox]=true, "&_fid_101=0", "&_fid_101=1")   & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])

Replace _fid_101 with your field Id and [Checkbox] field with your checkbox field name.

Please let me know if this works for you and need any further help.

Thanks,

Gaurav

No Problem

Here is an example of a URL Formula field

var text NewCheckboxValue = IF([Status]="New","0","1");


var text URL= URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_EditRecord"
& "&rid=" & URLEncode ([Record ID#])
& "&_fid_7=" & $New Status
& "&apptoken=" & "XXXX";

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

That last stuff is just boilerplate code (as long as you name your formula variable URL) which refreshes the page.

Jordan, my solution will refresh the page you were on, be it a record or a report.

  • Author
  • Quickbase Alumni
  • May 24, 2017
I am struggling to get this solution to work, 

I am currently using 

var text NewCheckboxValue = If([Priority]="New","0","1");

var text URL= URLRoot() & "db/" & [_DBID_TASK] & "?act=API_EditRecord"
& "&rid=" & URLEncode ([Record ID#])
& "&_fid_32=" & $New Priority;

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