cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Kovacs" <al...@fast.fujitsu.com.au>
Subject RE: woody2.js: custom validation issue in cocoon-2.1.2 to 2.1.4
Date Fri, 19 Mar 2004 05:43:34 GMT
> Alex Kovacs <alexk <at> fast.fujitsu.com.au> writes:
> 
> >             if (this.validator == null) {
> > 		  //if no custom validation
> >               this.isValid = this.form.isValid();
> >             } else {
> > 	          var validated = true;
> >
> > 	          if(!this.validator(this.form, bizData))
> > 	          	validated = false;
> >
> > 	          if(!this.form.isValid())
> > 	          	validated = false;
> >
> >               this.isValid = validated;
> >               finished = this.isValid;
> >             }
> 
> I have committed it this way to the forms block in CVS:
> 
> 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;
> }
> 
> Should work as well. Can you test it?
> 

Tested and it behaves the same way, i.e. does not show any custom
validation errors until all other fields are validated correctly.
However, this is not the change that I was hoping for ;-). 

I think the test "if (finished)" is the problem. It only allows for
custom validation just after the form is finished. The finished variable
comes from some lines above in woody2.js:
	finished = this.form.process(formContext);
So it seems the form is validated (i.e. finished) only if the built-in
validation is completed. And my understanding is that the form is not
finished until there are no errors, regardless if they are coming from
the custom validation or not. Therefore, I still think the fix above
does not solve my issues. I my code above I've actually removed the "if
(finished ...)" statement to make the fix working ok.

What do you think?
Alex



Mime
View raw message