cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <res1c...@verizon.net>
Subject Re: v2 Form.js how does onValidate work?
Date Thu, 18 Mar 2004 17:42:55 GMT
Tim Larson wrote:

>On Thu, Mar 18, 2004 at 02:33:51PM +0000, Tim Larson wrote:
>  
>
>>On Wed, Mar 17, 2004 at 02:31:53PM -0800, Christopher Oliver wrote:
>>    
>>
>>>Tim Larson wrote:
>>>      
>>>
>>>>On Wed, Mar 17, 2004 at 11:18:35AM -0800, Christopher Oliver wrote:
>>>>        
>>>>
>>>>>Tim Larson wrote:
>>>>>          
>>>>>
>>>>>>On Tue, Mar 16, 2004 at 09:16:38PM +0000, Tim Larson wrote:
>>>>>>var userErrors = 0;
>>>>>>this.formWidget_.validationErrorListener = function(widget, error)
{
>>>>>>    if (error != null) {
>>>>>>        userErrors++;
>>>>>>    }
>>>>>>}
>>>>>>            
>>>>>>
>>My new question is why we set the validationErrorListener function
>>pointer every time we go through the loop instead of just once.
>>Is this to protect against the possibility of the user's flowscript
>>messing with the pointer?
>>    
>>
>
>Answering myself: this is probably so we can pick up the brand new
>instance of the variable "userErrors" to use in the function, right?
>
>--Tim Larson
>
>  
>
That's correct. If you're worried about performance, keep in mind that 
in this case the function body itself is only compiled once (when the 
script is loaded). Runtime compilation only occurs if you use eval() or 
the Function() constructor.

Chris

Mime
View raw message