cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Lutz <mat...@gmx.at>
Subject Bug in org.apache.cocoon.forms.flow.java.FormInstance.java when handling submit widgets with validation = false ?
Date Wed, 24 Aug 2005 12:08:05 GMT
Hi list !

Not sure wether this is a bug, so I want to ask before posting to bugzilla

I have a form with a submit widget that has its attribute validate set 
to false.

Submitting this form results in:
-no validation, as expected
-NOT leaving the do while(!finished) loop in FormInstance.java -> not 
expected, I want processing to stop !

I debugged and found (see code snippet below)

-this.form.process returns true: CORRECT
(because Submit->handleActivate called getForm().endProcessing(false), 
so everything is allright here, the submit button tells the form to end 
processing)

-finished is true, so it enters the if to check for a flow added 
validator CORRECT
-this.isValid is set to this.form.isValid() no matter wether a validator 
is there (NOT IMPLEMENTED :-) ?)
-and finally finished is set to isValid, which kills everything when the 
form is submitted invalid, because form processing does not stop. BUG ?


<snip taken-from="org.apache.cocoon.forms.flow.java.FormInstance.java:208"
            finished = this.form.process(formContext);
         
            // Additional flow-level validation
            if (finished) {
                if (this.validator == null) {
                    this.isValid = this.form.isValid();
                } else {
                    this.isValid = this.form.isValid() /*& 
this.validator(this.form, bizData)*/;
                }
                finished = this.isValid;
            }
</snip>

So, I would say something like would be better, although not perfect.. 
because the flow validator has no idea wether the submit button was set 
to validate... maybe there's a better solution in the javascript 
classes, but I am not familiar with those...

<better-snip 
put-to="org.apache.cocoon.forms.flow.java.FormInstance.java:208"
            finished = this.form.process(formContext);
         
            // Additional flow-level validation
            if (finished) {
                if (this.validator == null) {
                    this.isValid = this.form.isValid();
                } else {
                    this.isValid = this.form.isValid() /*& 
this.validator(this.form, bizData)*/;
                    finished = this.isValid;
                }
            }
</better-snip>

Any ideas & suggestions on this ? Should I submit this to bugzilla with 
a patch ?

regards,
tom


Mime
View raw message