Forum Discussion

JustinPauga's avatar
JustinPauga
Qrew Cadet
7 years ago

URL Button to check a checkbox

I am trying to have a URL Button to check a checkbox if that checkbox is empty and do nothing if it is already checked. I would also like this button to be pressed from an embedded report.
Essentially, I have an Items table that is embedded into an estimate table. The items have the name, description, price and whether it is approved or not. The approved checkbox is unchecked until the customer decides they want to move forward with that line item so I need a button that can be pushed from the embedded report that will check the approved box and update the item
  • I was able to figure out how to do it using quickbases URL Formula Buttons for Dummies sample app but right now it redirects back to that line item and I need it to either not redirect or to redirect back to the related estimate
  • Justin, I see that you found my app in the Exchange

    Here is what you need


    var text URL =
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_55=1";

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

    Change 55 to your checkbox fid.

    this syntax refreshes the whole page, even when clicked off a child record on an embedded report on form,  or on a report.
    • JustinPauga's avatar
      JustinPauga
      Qrew Cadet
      Awesome, that worked perfectly. Thank you!

      I do have another similar question. I have time cards in my app with buttons that fill in the Time in and the Time out fields. I would like to change my code to do something similar where it will still fill out the time but refresh the current page, that way they can be done inside of embedded reports as well. My code for the clock in button is:

      If(IsNull([Time In]),
      URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid="& [Record ID#]
      & "&_fid_10=" & URLEncode (Now())
      &"&rdr=" & URLEncode(URLRoot()& "db/" & [_DBID_TIME_CARDS] & "?a=dr&rid=" & [Record ID#]),
      "javascript:alert('You are already clocked in.')")
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      I think that would be

      var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid="& [Record ID#]
      & "&_fid_10=" & URLEncode (Now());

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





      If(IsNull([Time In]),

      JavascriptDoAndRefresh,

      "javascript:alert('You are already clocked in.')")
      )
    • JustinPauga's avatar
      JustinPauga
      Qrew Cadet
      I'm getting a syntax error:
      The argument list of the function JavascriptDoAndRefresh must begin with a left parenthesis.

      I'm looking through trying to figure out where the argument list is as I have a beginners level of knowledge on javascript but maybe you can find the issue faster than me.