Can a checkbox be ticked on the view screen?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

Hello,

I think I already know the answer to this question but thought I'd ask anyways.

Is it possible that a checkbox can be ticked when you are viewing a record?  

We use a checkbox called Closed when a PO has been fulfilled, which then reporting uses to "drop" the order from the list.  To tick the box, you have to edit the record, tick the box, and save.

Is it possible to be able to simply tick the box directly when viewing the record, or must I take the steps above?

Its nothing big, just a matter of a few clicks, but certainly would add a little bit of value to the app to add speed wherever we can!

Thanks!

Michael Custer

Photo of Michael

Michael

  • 20 Points

Posted 4 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
no problem,

Try this code  in a formula URL field.  First check with the field ID for the checkbox field. You can see that on the usage tab of the field properties or else turn on Field ID's when viewing your field list.  Let's say the field ID is 10.

var text URL = urlroot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & totext([Record ID#]) & "&_fid_10=1";





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



I know that javascript stuff looks scary, but  all it does is to execute the URL and refresh the page.

The URL is just saying to edit the record and change fid 10 to be true ( ie 1).



Photo of Sybil

Sybil

  • 0 Points
If you put this in the Formula-URL field, and set it to display as a button, it works without JavaScript. Just replace the bold things with the values from your app.

var bool checkedstate = (If([MyCheckBox], true, true)) ;

URLRoot() 

& "db/" 

& Dbid() 

& "?a=API_EditRecord"

& "&rid="

& [Record ID#]

& "&_fid_6=" 

& $checkedstate 

& "&rdr=" 

& URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])
Photo of Michael

Michael

  • 20 Points
I really need to learn more about Javascript... it would offer me so many more possibilities in QB!  Thanks again!
Photo of Michael

Michael

  • 20 Points
ahhhh, a button!  That does makes sense.  I will check this out... thanks!
Photo of Matthew

Matthew

  • 0 Points
Is it possible to make this button work both ways, where a second click will uncheck the checkbox field?
Photo of Sybil

Sybil

  • 0 Points
Yes, with a one-word change: If([MyCheckBox], true, true) to If([MyCheckBox], false, true)

Also, if you have a lot of checkboxes that need to be set at once, you can do that with the same statement; just add a "var bool" to detect the state of each checkbox field, then add clauses to the API_EditRecord URL that you're creating in the formula. So for example, after

& "&_fid_6="
& $checkedstate

you could add

& "&_fid_7="
& $checkedstate2

(supposing that the next checkbox has a fid of 7 and the boolean that detects its state is called checkedstate2)
Photo of Nicholas

Nicholas

  • 0 Points
Thanks for this reply! It works for me as well. Can we also get the report to refresh after we've clicked the url?
Photo of Matthew

Matthew

  • 0 Points
I have

& URLEncode(URLRoot() & "db/" & Dbid() & "?a=q&qid=" & "12"

at the end of my formula, which returns to report id 12 after the url is clicked.

And I think there's a javascript method to refresh somewhere on here too, if that's what you're looking for.
Photo of Nicholas

Nicholas

  • 0 Points
As in, you're replaced the last line of the formula above with the line that you've provided here?
Photo of Matthew

Matthew

  • 0 Points
Yes