Discussions

Expand all | Collapse all

URL Parameter ""rl"" Prohibits RedirectURL from Occurring

  • 1.  URL Parameter ""rl"" Prohibits RedirectURL from Occurring

    Posted 03-01-2018 17:59
    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.


  • 2.  RE: URL Parameter ""rl"" Prohibits RedirectURL from Occurring

    Top
    Contributor
    Posted 03-01-2018 18:05
    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.


  • 3.  RE: URL Parameter ""rl"" Prohibits RedirectURL from Occurring

    Posted 03-02-2018 18:24
    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 


  • 4.  RE: URL Parameter ""rl"" Prohibits RedirectURL from Occurring

    Posted 03-02-2018 19:25
    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.


  • 5.  RE: URL Parameter ""rl"" Prohibits RedirectURL from Occurring

    Top
    Contributor
    Posted 03-02-2018 20:10
    I love that comment:
    ... for anyone that may need to overcome this "feature" in the future.


  • 6.  RE: URL Parameter ""rl"" Prohibits RedirectURL from Occurring

    Top
    Contributor
    Posted 03-23-2019 14:17
    Thanks Zach!  This is super awesome and helpful!  Just wanted to add the following:
    If you want to eliminate the automatic refresh issue with Solution #2, you can do that by removing the "rl" attribute value of a pesky hidden input element.  

    Here's the code: 
    $("input[name='rl']").attr('value','');