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???
|