CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> CodeCharge Studio -> General/Other

 problem with using php count in on validation event

Print topic Send  topic

Author Message
CodeChargenewbie

Posts: 114
Posted: 01/24/2008, 1:16 PM

I have a form on-validation event using custom code (PHP), as well as a Before Show event.

I have the following set of code the Before Show event:

Quote :
$Level2_Count_elements = (count($Form->Listbox->Values, COUNT_RECURSIVE) - count($Form->Listbox->Values)/(count($Form->Listbox->Values));

The value of count($Form->Listbox->Values, COUNT_RECURSIVE) is 33.

The value of count($Form->Listbox->Values is 11.

$Level2_Count_elements evaluates to (33-11)/(11) = 2.

So...$Level2_Count_elements is set to 2 at this point.

Now, I do the EXACT same assignment statement in an on-validation event and $Level2_Count_elements is being set to 0. Why? Well, after evaluating each distinguished operand, I discovered that they are all being set to 1.
Essentially, $Level2_Count_elements evaluates to (1-1)/(1) = 0.

The question is why is each operand being set to 1? In an on-validation event, which is after I click the submit button, does the listbox contain only 1 value -- is that the reason? What else it could be?

Thank you.

Another thing I noticed was a global variable in an on-validation event will evaluate to NULL every time. No matter what I do, I'll get NULL. However, if I do something like $test = 5 inside the validation event, $test will equal 5. But global variables don't work. It doesn't matter what value I set the global variable to; once the validation event function is called by codecharge, a global variable that's referenced inside the function will always evaluate to NULL. Is there anyway I can pass in a variable to the on-validation event for manipulation???
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.

Web Database

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.