I've been taking a look at the following function found in file "woody.js".
What I would like to understand is exactly how the form would be displayed to the user and, upon (re-)submission, the execution return to where the comment reads:
   
    "_show creates a continuation, the invocation of which will return right here".
 
Digging through code appears to be encouraged by the Cocoon community (and actually in many instances the only way of understanding how things work).
So, I guess you would not mind this question...
 
Thanks,
 
jlerm
 

Form.prototype.show = function(uri, validator, locale) {
    var lastWebCont = this.lastWebContinuation;
    // create a continuation, the invocation of which will resend
    // the page: this will be used to implement automated "back"
    // navigation
    var wk = this.start(lastWebCont);
 
    if (locale == null)
        locale = java.util.Locale.getDefault();
 
    while (true) {
        if (cocoon.request == null) {
            // this continuation has been invalidated
            this.dead = true;
            handleInvalidContinuation();
            Woody.suicide();
        }
        var thisWebCont = this._show(uri, locale, wk);
        // _show creates a continuation, the invocation of which
        // will return right here: it is used to implement
        // automated "next" navigation
        if (this.dead ||  cocoon.request == null) {
            // this continuation has been invalidated
            handleInvalidContinuation();
            suicide();
        }
 
        var formContext =
            new Packages.org.apache.cocoon.woody.FormContext(this.woody.request, locale);
        var finished = this.form.process(formContext);
        var evt = formContext.getActionEvent();
        if (evt != null) {
            this.submitId = String(evt.getActionCommand());
        } else {
            this.submitId = undefined;
        }
        if (validator != undefined) {
            finished = validator(this) && finished;
        }
        if (finished) {
            break;
        }
    }
}

Reply via email to