CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.

YesSoftware Forums -> CodeCharge Studio -> PHP

 Create a Variable when Search is used.

Print topic Send  topic

Author Message

Posts: 48
Posted: 04/19/2013, 5:24 PM


I need to hide a Panel based on a Search result

I've already done it on the record form, using DLookup & CCGetParam to create a Variable, and use it to find a record in the DDBB, if this record exists, then show the Form (Visible = Yes) using Hide-Show Component. All this in the Before Show Event.

This same approach doesn't work with the Panel, it displays a "Variable $my_variable is not declared", I assumed this is because this variable is create with the Form (Before Show) and this event occurs after the Panel is created.

So I'm trying to create the variable at search, and then use the Panels Before Show event to hide it. I've tried all the events available for the Search form, even the OnClick of the Search Button, but stills the variable is empty.

any clue on what I'm doing wrong?
View profile  Send private message

Posts: 639
Posted: 04/19/2013, 9:44 PM

You could use custom code in the before show event

if($variable == whatever){
$panel->visible = false;

$panel->visible = false;
if($variable != whatever){
$panel->visible = true;
Central Coast, NSW, Australia.

View profile  Send private message
Posted: 04/20/2013, 12:53 AM

Globalize your variable so you can use it in the other functions. Each
'event' in CodeCharge is simply a function. So if a variable is defined
within that function, it's scope is only available within that function.

You can use the Declare Variable action. So in your record form's Before
Show, add a Declare Variable action before your Dlookup action. The
generated code will look something like:

//Declare Variable @256-3BE6D7AF
global $MyVariable;
$MyVariable = null;
//End Declare Variable

//DLookup @255-13B29B12
global $DBConnection1;
$Page = CCGetParentPage($sender);
$ccs_result = CCDLookUp("yada", "blabla", "id=" .
CCToSQL(CCGetParam("id", ""), ccsInteger),
$ccs_result = strval($ccs_result);
$MyVariable = $ccs_result;
//End DLookup

More info:

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

Internet Database

Visually create Web enabled database applications in minutes.

Home   |    Search   |    Members   |    Register   |    Login

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