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
------------------------------
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
------------------------------- JeffPeterson13 years agoQrew Captain
What should happen when they submit? Is it meant to edit some part of a record? The URL1 variable is meant to edit the record in some way.
You need to update the code in var URLONE to do whatever is meant to happen when they press the button, then it will do that action and redirect to the thank you page.var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&apptoken=YOUR_APP_TOKEN"
& "&_fid_17="&"Submit";
In this case, the fid_17 is the field ID for MY field that holds the status, you might not have this, or yours is different.
------------------------------
Jeff Peterson
------------------------------