Forum Discussion
Hi Kendyl,
looks your missing some info in your formula there.
All you have there is the variable called 'rdrURL'.
Here's the code from a button I have that is doing something similar when someone hits the 'decline' button on a form. This code changes a multiple choice field to 'Decline' then redirects the user to a simple page that confirms they have declined. You should be able to change this code to fit your need.
This is a formula-rich text field.
var text ButtonWords = "Decline";
var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&apptoken=YOUR_APP_TOKEN"
& "&_fid_17="&"Decline";
var text URLTWO = URLRoot() & "db/" & AppID() & "?a=showpage&pageid=3";
var text URL =
$URLONE
& "&rdr=" & URLEncode($URLTWO);
// Begin button style
var text bgcolor = "#cc4c2f";
var text txtcolor = "white";
var text style = "style=\"text-decoration: none; width: 100px; text-align: center; background:" & $bgcolor & "; border-radius: 5px; padding: 8px 10px; color: " & $txtcolor & "; display: inline-block; font: normal 700 24px/1 \"Calibri\", sans-serif; text-shadow: none;";
// End button style
"<a " & $style & " href=" & $URL & ">" & $ButtonWords & "</a>"
------------------------------
Jeff Peterson
------------------------------
- KendylBrockman3 years agoQrew MemberHi Jeff,
Thank you so much for your response! Would I put the URL I'd like to be redirected to after "var text URL = " or where would that go?
Kendyl
------------------------------
Kendyl Brockman
------------------------------- JeffPeterson13 years agoQrew CaptainYou can replace the URL2 variable with the URL you are redirecting to.
var text URLTWO = "www.myredirecturl.com";
------------------------------
Jeff Peterson
------------------------------- KendylBrockman3 years agoQrew Member
Hi Jeff,
I tried adding in my URL and although the "submit" button is working it's still not redirecting to the page I'd like. Here is my code, can you see if I've put something in wrong?
var text ButtonWords = "Submit";
var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&apptoken=YOUR_APP_TOKEN"
& "&_fid_17="&"Submit";
var text URLTWO = "https://ruralhealth.health.utah.gov/hwac-thankyou/" & "db/" & AppID() & "?a=showpage&pageid=3";
var text URL =
$URLONE
& "&rdr=" & URLEncode($URLTWO);
// Begin button style
var text bgcolor = "#1AA1B7";
var text txtcolor = "white";
var text style = "style=\"text-decoration: none; width: 100px; text-align: center; background:" & $bgcolor & "; border-radius: 5px; padding: 8px 10px; color: " & $txtcolor & "; display: inline-block; font: normal 700 24px/1 \"Calibri\", sans-serif; text-shadow: none;";
// End button style
"<a " & $style & " href=" & $URL & ">" & $ButtonWords & "</a>"
Thank you!Kendyl
------------------------------
Kendyl Brockman
------------------------------