Jump to content
  • 0

Automatic Redirect Based On The Availability Of Required Parameters



I'm curious if anyone here knows how to have a user redirected to a web page (URL/Datapage/Etc) if a datapage that requires a parameter notices that parameter has not been received for any reason.

For example, our users upon login are directed to a page where they select from a dropwon project they are working on. The project that is selected passes a Project_ID parameter that is required in many other datapages in our system. This is so that the user does not have to repeatedly select the project on each datapage after. This parameter is currently stored in the browser cache and frequently over time is either corrupted or removed from the browser cache. Thus making any datapage that normally receives the *Required parameter Project_ID display some sort of error due to the lack of the parameter.

I would like to choose a URL/datapage/etc that would be a redirect destination if this required parameter is not present. In my previous example this destination would be the webpage where the user selects the Project and can pass the Project_ID parameter again. Ideally it would function similarly to basic authentication redirections where it checks the datapage attempting to be accessed against some specified criteria and redirects they user if the criteria is not satisfied.


If anyone has accomplished something similar to this I'd be eager to hear about it.


Thanks in advance

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi codell,


How are you doing?


I think, it's better to create an App Parameter (for example, name it "RedirectURL" and enter the URL of your DataPage as value).

Then add a Header&Footer element to your DataPages, select the Header element, click the Source button and enter the code like following:

var ValueParam='[@testParam]';
var redirectURL='[@app:RedirectURL]';
if(ValueParam.length==0) window.location.assign(redirectURL);

Enter the name of your parameter instead of "testParam" and the name of your App Parameter instead of "RedirectURL".


I'll be grateful, if you tell me if the code works or if any errors occur.

Have a nice day!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...