cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Larson <...@keow.org>
Subject Re: v2 Form.js how does onValidate work?
Date Tue, 16 Mar 2004 21:35:26 GMT
On Tue, Mar 16, 2004 at 09:16:38PM +0000, Tim Larson wrote:
> I am trying to migrate to the v2 Form.js, but I am having trouble
> understanding how the onValidate handling works.  From reading to code
> it looks to me like it would not work correctly, but the sample form
> work properly.  Could somebody explain how the interaction of the
> regular validation, the onValidate function, and the continuation
> bookmark works? (via email or IRC)
 
One of the specific questions is in this code:
    var userErrors = 0;
    this.formWidget_.validationErrorListener = function(widget, error) {
        if (error != null) {
            userErrors++;
        }
    }
    var finished = javaWidget.process(formContext);
    if (this.onValidate) {
        this.onValidate(this);
    }
    if (!finished || userErrors > 0) {
        cocoon.continuation = this.local_.webContinuation;
        this.local_.webContinuation.continuation(this.local_.webContinuation);
    }
    return wk;

How does the call to "this.onValidate(this);" affect whether the form is
redisplayed to the user when it does not modify either of the variables
"finished" or "userErrors"?

Another question is what line triggers the return to the bookmarked
continuation?  My first guess would be the line "cocoon.continuation = ...",
but that would mean the next line would never get executed...any help
understanding this would be appreciated.

--Tim Larson

Mime
View raw message