Forum Discussion
QuickBaseJunkie
Qrew Legend
5 years agoHere you go! I plan to make a video on this topic soon.
This particular formula/code page passes a URL to display a specific form to a pop-up print window, then returns the user to the page they were on.
This would replace the 'onclick' use in a rich text formula field. Additional parameters (name=value) can be passed they just need to be separated with a "&".
FORMULA - URL:
URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=17" & // code page
"&url=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=printr&dfid=10&rid=" & [Record ID#])//passed to code page for print window
CODE PAGE:
<!DOCTYPE html>
<html>
<head>
<script>
var urlParams = new URLSearchParams(window.location.search);
var url = urlParams.get('url');
var referrer = document.referrer;
window.open(url,'Print','width=800,height=700');
window.location.replace(referrer);
</script>
</head>
</html>
Let me know if this works for you š
------------------------------
Sharon Faust (QuickBaseJunkie.com)
Founder, Quick Base Junkie
https://quickbasejunkie.com
------------------------------
This particular formula/code page passes a URL to display a specific form to a pop-up print window, then returns the user to the page they were on.
This would replace the 'onclick' use in a rich text formula field. Additional parameters (name=value) can be passed they just need to be separated with a "&".
FORMULA - URL:
URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=17" & // code page
"&url=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=printr&dfid=10&rid=" & [Record ID#])//passed to code page for print window
CODE PAGE:
<!DOCTYPE html>
<html>
<head>
<script>
var urlParams = new URLSearchParams(window.location.search);
var url = urlParams.get('url');
var referrer = document.referrer;
window.open(url,'Print','width=800,height=700');
window.location.replace(referrer);
</script>
</head>
</html>
Let me know if this works for you š
------------------------------
Sharon Faust (QuickBaseJunkie.com)
Founder, Quick Base Junkie
https://quickbasejunkie.com
------------------------------
- AdamKeever15 years agoQrew Commander@Sharon Faust, thanks so much for posting this. I am going to see if I can get it functioning on my end.ā
------------------------------
Adam Keever
------------------------------- AdamKeever15 years agoQrew CommanderIt works on my end, but results in an endless loop of page reloads. I have to close the page to get it to stop.
@Sharon Faust and @Ryan Pflederer any suggestions?
------------------------------
Adam Keever
------------------------------- QuickBaseJunkie5 years ago
Qrew Legend
@Adam Keever I know we're also discussing the Slack channel, but I didn't want to leave this post hanging.
ā
I would suggest passing your desired redirect as part of the URL and using it in place of the referrer... which should help with the loop. (I'm using chrome, and have not experienced a looping issue with the code)
Also, this is only intended to use with a previously saved record as it needs the Record ID to function.
Something along the lines of this:
FORMULA - URL:
URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=17" & // code page
"&url=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=printr&dfid=10&rid=" & [Record ID#]) & //passed to code page for print window
"&rdrurl=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])//passed for final redirect
CODE PAGE:
<!DOCTYPE html>
<html>
<head>
<script>
var urlParams = new URLSearchParams(window.location.search);
var url = urlParams.get('url');
var rdrurl = urlParams.get('rdrurl');
window.open(url,'Print','width=800,height=700');
window.location.href = rdrurl;
</script>
</head>
</html>
------------------------------
Sharon Faust (QuickBaseJunkie.com)
Founder, Quick Base Junkie
https://quickbasejunkie.com
------------------------------