• 0
Hearnie

Links to Other Pages

Question

Javascript help please

 

I have a web page on which I wish to display a hyperlink depending on the status of a specific field from my authentication table.

 

The authorisation field “[@authfield:Staff_List_Branch_Type]” has two options which are “FS” or “SIS”.  Depending on the authorisation of the user I would like to display a link that will take the user to a specific web page depending on their Branch_Type status. 

 

So if your autfield branch type is “FS” a link will display that will take you to web page A, however if your branch is “SIS” a link will display that will take you to web page B.  There must only be one link displayed

 

Any help or ideas greatly appreciated

 

Steve

Share this post


Link to post
Share on other sites

2 answers to this question

  • 0
6 hours ago, Hearnie said:

Javascript help please

 

 

 

I have a web page on which I wish to display a hyperlink depending on the status of a specific field from my authentication table.

 

 

 

The authorisation field “[@authfield:Staff_List_Branch_Type]” has two options which are “FS” or “SIS”.  Depending on the authorisation of the user I would like to display a link that will take the user to a specific web page depending on their Branch_Type status. 

 

 

 

So if your autfield branch type is “FS” a link will display that will take you to web page A, however if your branch is “SIS” a link will display that will take you to web page B.  There must only be one link displayed

 

 

 

Any help or ideas greatly appreciated

 

 

 

Steve

 

Hi Steve,

I would recommend using Cascading elements for this purpose, there is no need to use JS. I assume that you use type of the datapage which allows using cascading (submission, update, details forms)

Create a virtual field and onload receive value from authentication field. Then create a look up table with two columns and two records and fill out customer statuses and URLs.

Then add one more virtual which will be cascading text field. Use first virtual field as a parent field. If you need to redirect user to that URL after submission, use this solution

Hope that helps

Share this post


Link to post
Share on other sites
  • 0

If its a result page,

You could put the code below in the header(Source)

 

authentication needs to be enabled.

change the "http://.." to the appropriate URL.

Hope this helps..

 

<div id="myDiv1"></div>
<SCRIPT LANGUAGE="JavaScript">

var myDiv1 = document.getElementById("myDiv1");
var branchtype ='[@authfield:Staff_List_Branch_Type]';

//alert(branchtype);
   
if (branchtype=='FS')

{

myDiv1.innerHTML = "<b><h3><a href=\"http://www.google.com\">Google</a></hr></b>";

}


else if (branchtype =='SIS')

{

myDiv1.innerHTML = "<b><h3><a href=\"http://www.amazon.com\">Amazon</a></hr></b>";
}

</script>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now