Jump to content
  • 0

Passing Caspio Parameter To An External Html Code


Question

Hi,

 

My goal is to conditionally hide text/ links etc. based on whether the user is logged in or not. TO be more specific, i want the login text to change into a "Hi user..... Logout" link whenever he has logged in.

 

In my datapage i have enabled parameters and writting the following code in an HTML block

 

<br />
<script>
var type_user='[@field:Resume]';
</script>

 

where Resume is a Yes/no field in the same dataset, it is a Yes for all users.

 

 

On my website, i have an HTML code which goes like

<script>
if (type_user=='Yes') {
document.getElementById("uniquename").style.display = "none";
}
else {
document.getElementById("uniquename").style.display = "block";
}
</script>

 

<div id="uniquename" style="display:block;">
<p>I am something.</p>
</div>

 

Please help!

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello josephstanley,

 

Welcome to Caspio forum!

 

If I understand correctly, you want to display a text, if a user is logged in a DataPage.

 

I used the following steps:

  1. On a WebPage, added the following code
  • <div id = "divId" style = "display:none;">Display me, if a user logs in!</div>
  • On a DataPage, added a Header&Footer element, selected the Footer, clicked the Source button and entered the following code:
  • <script>
    document.getElementById("divId").style.display = "block";
    </script>
    

 

If a user does not log in, the code does not execute and the text is hidden.
When a user log in, the code executes and the text is displayed.
 
I hope, it helps.
Link to post
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
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...