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

 Retrieve variable value...

Print topic Send  topic

Author Message
Jack_Walter

Posts: 39
Posted: 09/21/2008, 6:49 AM

Hi,

I have a recordform with some custom code in the AfterExecuteUpdate event (I'm doing some calculations there to insert those values in a different table).

One of the first things I do in the custom code is to get a variable value:

$thisTourID = $Component->tour_id->GetValue();

I need this value later on in my sql updates.

The record form has 3 listboxes and one of them lists the tour name, based on the value of the tour_id.

Because this recordform does only allow updates (and no inserts) I want to disable these 3 listboxes. I do that with custom code in the BeforeShow event for each listbox entry (and I use a label for each listbox):

e.g.:
$Component->Attributes->SetValue('DisableDropDownTour', 'disabled');

If I do so my $thisTourID variable won't deliver the correct value (in fact, no value at all).

So I removed the the custom code for the tour_id listbox and now I'm retrieving the correct value.

I'm now thinking about a different approach:

Put the disable code for all listboxes in the Before Show event of the record form (of course I'd have the SetValue lines to $Component->tour_id->Attributes...) and at the beginning of this code block I'd get the tour_id and save it into a different variable (e.g. globalTourID).

It would look like this:

  
$thisTourID = $Component->tour_id->GetValue();  
$globalTourID = $thisTourID;  
$Component->tour_id->Attributes->SetValue('DisableDropDownTour', 'disabled');

In my understanding I now still have a correct value from tour_id in the $globalTourID variable and it wouldn't matter any more that I loose the $thisTourID variable.

The thing is: In my AfterExecuteUpdate event I don't have a value at all if I read out the $globalTourID variable...

Before Show event of the record form:

global $globalTourID;  
 $globalTourID = $Component->tour_id->GetValue();  
 echo "<br>" . "Global Tour ID before Show: " . $globalTourID . "<br>";

This echos the correct value when I open the record form.

After Execute Update event of the record form:

echo "<br>" . "Global Tour ID: " . $globalTourID . "<br><br>";  

No value is displayed. Somehow this event does not recognize this variable any more?

Regards,
Jack
View profile  Send private message
mrachow


Posts: 509
Posted: 09/21/2008, 11:37 PM

What is the type of your control ($Component->tour_id)?
A label for example won't be posted back to the server.
_________________
Best regards,
Michael
View profile  Send private message
Jack_Walter

Posts: 39
Posted: 09/22/2008, 12:46 AM

It's a listbox (the control type).

The properties-data-settings are:

http://www.bildercache.de/anzeige/20080922-094521-159.jpg

Regards,
Jack
View profile  Send private message
mrachow


Posts: 509
Posted: 09/22/2008, 11:41 PM

Sorry Jack,

my look at your code was to hasty.

Try to define
Quote :
$globalTourID;
somewhere outside all functions in your ..._events.php file.
Maybe before
Quote :
function BindEvents()
.
_________________
Best regards,
Michael
View profile  Send private message
Jack_Walter

Posts: 39
Posted: 09/23/2008, 6:58 AM

Thank you Michael,

i'll give it a try :-)

Regards,
Jack
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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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