Forum Discussion
QuickBaseCoachD
7 years agoQrew Captain
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.
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.
- JustinPauga7 years agoQrew CadetAwesome, 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.')") - QuickBaseCoachD7 years agoQrew CaptainI 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.')")
) - JustinPauga7 years agoQrew CadetI'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. - JustinPauga7 years agoQrew CadetI solved it by taking out the var text JavascriptDoAndRefresh and just putting the logic inside of the if statement like this:
var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid="& [Record ID#]
& "&_fid_10=" & URLEncode (Now());
If(IsNull([Time In]),
"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.reload(true);" &
"});" & "void(0);",
"javascript:alert('You are already clocked in')") - QuickBaseCoachD7 years agoQrew CaptainOK, so all good now?
- JustinPauga7 years agoQrew CadetYup, I think it is all sorted now. I appreciate your help.
I do have a quick question though, is there any documentation or a guide that explains the javascript syntax for quickbase? I have seen the beginning guides but they are extremely basic and aren't a very good help in trying to figure out more complicated URL Forumlas - QuickBaseCoachD7 years agoQrew Captain:) As far as I know the only resource is scraping answers off this forum and saving them. I have an app with a table where I save all my favorite tricks. The only other possible resource is if any of the Quick Base university videos cover it.
If you just want to use the easy javascript, It's basically that code you are using to refresh the page along with this one below which will do the edit, but will not refresh the page. Some times you do not want to refresh the page as it delays the next click and jiggles the screen around on the user, when they have multiple clicks to do.
var text URL = URLRoot() & "db/" & "?act=API_EditRecord&_fid_80=1&rid=" & [Record ID#];
"javascript:" &
"$.get('" &
$url &
"',function(){" &
"$.jGrowl('This Item has been put on PO CANCEL snooze', {life: 5000, theme: 'jGrowl-green'});" &
"});" &
"void(0); - RaviSiddana5 years agoQrew TraineeHi,
I have the same requirement. I have been using the script in a "formula URL" field. However its not working. Could you please help me?
Regards,
Ravi
------------------------------
Ravi Siddana
------------------------------- MarkShnier__You5 years agoQrew LegendCan you explain what you want the button to do and post your current code which is not working?
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------
- KristenBrown__s2 years agoQrew Member
Hello, is there an update to this code given the changes with javascript?
------------------------------
Kristen Brown (she/her)
------------------------------- MarkShnier__You2 years agoQrew Legend
Here is an example
var text Approve = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#])
& "&_fid_144=Approved";
var text RefreshPage = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();
$Approve
& "&rdr=" & URLEncode($RefreshPage)
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------