CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Hiding a label based on table value

Print topic Send  topic

Author Message
ckroon

Posts: 869
Posted: 08/02/2007, 12:54 AM

Hi all. Found a lot of post regarding really complex panel hides but this one is simple.
I have a grid: 'content'. There is a label on that grid: 'email1', which is in a panel 'panel1'.

When a user registers they can choose to have certain info like their email or city of residence viewable on their profile page or not. I want the label to show if the field has a Y in it, and be invisible if there is a N.

I have been playing around with snippets of code but they have all been disastrous :)

Thanks for the help.
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
TonyReid


Posts: 159
Posted: 08/02/2007, 3:06 AM

Would it not be better to modify the SQL WHERE statement of the Grid so that it doesn't pull the field at all if another field is set to true?
_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
wkempees


Posts: 1679
Posted: 08/02/2007, 3:23 AM

Are you talking Grid or Record Form?
Make sure each panel has a name, and you know it.
(Default naming is Panel1, Panel2 and so on)
Check the initial setting for the Panelx, Visible Yes/No.
Do you have the field you want to check as a hidden field on the form?

Before Show event of the Grid/Form.
//-----
if ($Container->HiddenFieldname->GetValue() =='Y') {
$Container->Panel1->Visible = True; // Yes also allowed I think
} else{
$Container->Panel1->Visible = False; // No also allowed I think
}

In a Grid you need some extra attention to what row you are in.
Tony's solution, not retreiving the data through SQL is a good one, but your question was hiding showing panels.
Walter




Before show event of the Panel.

$Component->Visible = true;
$Component->Visible = false;

Also check initial setting of the Panel
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
DonB
Posted: 08/02/2007, 10:04 AM

that would be my vote, sort of. Use a CASE structure in the SQL statement
to hide fields that are to be excluded:

SELECT col1, col2 col3, CASE WHEN col5=true THEN col4 ELSE '' END as col4,
col5 FROM sometable WHERE whatever=value

If col5 controls the show/hide (true = show, false = hide), then the CASE
will only display col4 IF col5 says it's OK to display it. Of course 'col5'
doesn't need to be physically in the same table because you could join the
data table to another table such as 'profile' table to get whatever value
serves the function of col5 in my example.

--
DonB

http://www.gotodon.com/ccbth


"TonyReid" <TonyReid@forum.codecharge> wrote in message
news:546b1ac99bb6ba@news.codecharge.com...
> Would it not be better to modify the SQL WHERE statement of the Grid so
that it
> doesn't pull the field at all if another field is set to true?
> _________________
> Using: CodeCharge Studio 3.0 - IIS, PHP and MSSQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

ckroon

Posts: 869
Posted: 08/02/2007, 5:31 PM

THanks for all the great advice guys. WIll sort through things and figure out which one is best.

_________________
Walter Kempees...you are dearly missed.
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.