Jump to content

COnditionally display deploy codes


Recommended Posts

On 10/20/2017 at 6:50 PM, pgjacob said:

I was wondering if you could conditionally display deploy code based on a passed parameter.  If the parameter = X, then show the deploy code, if not, then hide it.

thanks

I would hide  datapage is parameter is not equal to X. You may find an example below:

<script type="text/javascript">
window.onload= function my_funct(){

var check='[@param]';
if (check != 'X'){
  document.getElementById("caspioform").style.display = 'none';  
}
}
</script>
Link to comment
Share on other sites

Thank you.  But how do I arrange this in the webpage.  Do I embed the deploy code within this hide function or are they separate?  And if there are several conditions, can I just add in more statements or do I use an OR statement?, e.g.

var check='[@param]';
if (check != 'X'){
  document.getElementById("caspioform").style.display = 'none'; 
var check='[@param]';
if (check != 'Y'){
  document.getElementById("caspioform").style.display = 'none'; 

 

Link to comment
Share on other sites

I put this in the footer and I cannot seem to get it to work...

The passed parameter is in the URL and I tested with this parameter,if the param (I substituted the field with the field picker) = passed parameter, then display is none, but it displays...

 

http://itselementaryff.weebly.com/stats.html?playerid=491&position=D/ST&cbResetParam=1

 

param passed is D/ST, and the datapage footer as results is:

 

<script type="text/javascript">
window.onload= function my_funct(){

var check='[@field:All_Players_Position]';
if (check !='D/ST'){
  document.getElementById("caspioform").style.display = 'none';  
}
}
</script>

 

 

I tried it as the actual field name and also as the value I assigned to it when passing ([@position]) and it showed in both instances

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