cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From coli...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript xmlForm.js
Date Tue, 01 Apr 2003 20:02:43 GMT
coliver     2003/04/01 12:02:43

  Modified:    src/java/org/apache/cocoon/components/flow/javascript
                        xmlForm.js
  Log:
  fixed bug where violations from a page would be incorrectly displayed on its previous page
when you press the back button
  
  Revision  Changes    Path
  1.9       +20 -4     cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/xmlForm.js
  
  Index: xmlForm.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/xmlForm.js,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- xmlForm.js	1 Apr 2003 19:25:11 -0000	1.8
  +++ xmlForm.js	1 Apr 2003 20:02:43 -0000	1.9
  @@ -58,10 +58,27 @@
    * @return [WebContinuation] a new WebContinuation instance
    */
   XForm.prototype.start = function(lastCont, timeToLive) {
  +    var result = this._start(lastCont, timeToLive);
  +    // 
  +    // _start() will return an Object when it's called
  +    // the first time. However, when its Continuation is invoked it
  +    // will return a WebContinuation instead. In the latter case
  +    // we're going back to the previous page: so
  +    // clear the current page's violations before showing the previous page
  +    // Without this, violations from the current page will
  +    // incorrectly be displayed on the previous page.
  +    if (result instanceof WebContinuation) {
  +        this.form.clearViolations();
  +        return result;
  +    }
  +    return result.kont;
  +} 
  +
  +XForm.prototype._start = function(lastCont, timeToLive) {
       var k = new Continuation();
       var kont = new WebContinuation(this.cocoon, k, 
                                      lastCont, timeToLive);
  -    return kont;
  +    return {kont: kont};
   } 
   
   /**
  @@ -142,7 +159,6 @@
    */
   XForm.prototype.sendView = function(phase, uri, validator) {
       var lastCont = this.lastContinuation;
  -    this.form.clearViolations();
       var view = this.form.getFormView(this.cocoon.environment.objectModel);
       while (true) {
           // create a continuation, the invocation of which will resend
  @@ -167,7 +183,7 @@
               handleInvalidContinuation();
               suicide();
           }
  -        this.form.populate( this.cocoon.environment.objectModel);
  +        this.form.populate(this.cocoon.environment.objectModel);
           if (validator != undefined) {
               validator(this);
           }
  
  
  

Mime
View raw message