CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Problem with hiding/showing component (solved)

Print topic Send  topic

Author Message
ksa

Posts: 27
Posted: 12/01/2013, 7:06 AM

I have a page where I want to hide certain components for everyone but members of the admin group (1). It works just fine on a panel I put at the top of the page, but when I want to do the same thing for an element within a grid row, it doesn't work.

I have the panel set as invisible as the default, and then I apply this custom code to the panel in order to show it to admins:

  
if (CCGetGroupID() == 1 ){   
$paneladmin->Visible = True;  
}  

For the panel located within the grid, the default setting is also invisible. Then I apply this custom code to the panel:

  
if (CCGetGroupID() == 1 ){   
$paneledit->Visible = True;  
}  

That is, it's the exact same code except for the component name. The top panel comes and goes just fine depending on who is logged whereas the panel within the grid is always invisible.

If I invert things and let the panel be visible as the default and use a
(CCGetGroupID() !== 1
to hide it for non-admins, it's always visible.

It drives me crazy. What did I miss?
View profile  Send private message
saseow

Posts: 744
Posted: 12/01/2013, 7:35 AM

I always use this code and it works for any components with a panel. Put a panel around the item you wish to hide and then in the BeforeShow event:

if (CCGetSession("GroupID") == 1)
{
$Component->Visible = true;
}
else
{
$Component->Visible = false;
}
View profile  Send private message
ksa

Posts: 27
Posted: 12/01/2013, 9:56 AM

Thank you! Simple but effective. It worked like a charm!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.