URL Parameter "rl" Prohibits RedirectURL from Occurring

  • 1
  • 1
  • Question
  • Updated 9 months ago
  • In Progress
I have a form that when the status is set to "approved" I update the RedirectURL input to point to a code page I have created that takes care of automatically creating records. However, whenever a user comes from a Report Link to this form the url parameter rl= is added and this seems to override the RedirectURL...

How can I tell the form to ignore the rl= so that way I can make sure the form goes to my code page whenever RedirectURL is set.
Photo of Zach Case

Zach Case

  • 234 Points 100 badge 2x thumb
  • sad

Posted 9 months ago

  • 1
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 27,784 Points 20k badge 2x thumb
You have to set rl to an empty string or RedirectURL does nothing. 

I am not sure what you are doing when you  say "I update the RedirectURL input to point to a code page" so post your formula, script or details of whatever mechanism you are using to make that change.
Photo of Zach Case

Zach Case

  • 234 Points 100 badge 2x thumb
Thanks for the reply, Dan, helped me remove the thought that I could handle rl the same way I handle z.

We did come up with two solutions, which are laid out below. Both listed with their Pros/Cons for anyone that may need to overcome this "feature" in the future.

---

Solution #1:
Simply create a new Formula - URL field that creates an edit (a=er) link to the record, this way you can moderate which URL Parameters are added. Then you will need to add this new field/link/button (I'll refer to it as the "Edit Button" here out), to all the reports you know a user could access the record(s) from. In addition, you need to edit the reports to not show the native "View" and "Edit" links. Now your users will use the new "Edit Button" you created to edit these records and the rl parameter will not be present so the RedirectURL will be respected.

Pros: A user can go directly to a record from the forms we updated and not have any extra page refreshes, as well as the RedirectURL will work every time when coming from those new "Edit" buttons. Also, this is a "no-code" solution, that only requires a Formula - URL field.

Cons: You have to know, and moderate, all the places a user may come from to view/edit a record. If a user finds or creates a report, that was not updated, the rl= parameter will still exist and your RedirectURL will not be respected.

---

Solution #2:
Using the Image Onload technique, load a code page .js file to the form via a Formula - Rich Text field (The code for the image onload technique and the code page are included at the bottom). In the .js code page, I have a function that will take the page's URL, remove the rl= parameter and then refresh the page without it. When the page refreshes without the rl= parameter the RedirectURL will be respected.

Pros: Removes the necessity to know where your users may come from, eliminating any unknown edge cases. All that is needed is to include the Formula - Rich Text field on any reports you need the RedirectURL to be respected on.

Cons: This solution does require the user to experience an automatic page refresh as the form loads if the rl= parameter is present. However, if the parameter is not present, there will be no refresh. This solution also requires some custom coding but should be as easy as copying and pasting the values provided as no changes are required.

---

Solution #2 Formula - Rich Text Value:
"<img qbu=\"module\" src=\"/i/clear2x2.gif\" " &
"onload=\"javascript:if(typeof QBU=='undefined'){QBU={};$.getScript('" &
URLRoot() &
"db/" &
Dbid() &
"?a=dbpage&pagename=removeRLParameter.js&rand='+Math.random())}\">"
Solution #2 .js Code Page:
https://pastebin.com/2rWgEzjk 
Photo of Zach Case

Zach Case

  • 234 Points 100 badge 2x thumb
Edit: The Pastebin has been updated so that we only remove the rl= url parameter only when we are editing a record. If you want this behavior to happen on all record view types, just remove the && isEditing part of the last conditional.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 27,694 Points 20k badge 2x thumb
I love that comment:
... for anyone that may need to overcome this "feature" in the future.