Jump to content

Display button on a HTML page based on condition


Recommended Posts

Hi 

I need to add a button that will redirect to a specific page on a HTML form

This button must be visible or not visible based on a condition from an authentication field

I created the html form and added this code:

<script>
if("[@authfield:User_Role]" == "Manager")

{

     ---> Add a code here that will show a button that will redirect to a page

}

</script>

 

Can someone send me an example code that I can place between the brackets?   I tried several options but nothing works.  

Link to comment
Share on other sites

On 8/26/2017 at 3:40 AM, LuluSW said:

Hi 

I need to add a button that will redirect to a specific page on a HTML form

This button must be visible or not visible based on a condition from an authentication field

I created the html form and added this code:

<script>
if("[@authfield:User_Role]" == "Manager")

{

     ---> Add a code here that will show a button that will redirect to a page

}

</script>

 

Can someone send me an example code that I can place between the brackets?   I tried several options but nothing works.  

Try using document.write, e.g.:


document.write('<button onclick=document.location.href="https://www.google.com">take  me away</button>');
 

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.

Guest
Reply to this topic...

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