Jump to content
  • 0

Links to Other Pages


Hearnie

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

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 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

Link to comment
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>

Link to comment
Share on other sites

  • 0

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.

Guest
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.

Loading...
×
×
  • Create New...