cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Kovacs" <>
Subject woody2.js: custom validation issue in cocoon-2.1.2 to 2.1.4
Date Wed, 17 Mar 2004 05:04:17 GMT
I may be wrong, but it seems the current implementation of woody2.js
flowscript has a problem when using custom validation together with the
woody's built-in validation. 

The following is the current fragment in question:
        // Additional flow-level validation
        if (finished && this.form.isValid()) {
            if (this.validator == null) {
              this.isValid = true;
            } else {
              this.isValid = this.validator(this.form, bizData);
              finished = this.isValid;

The "if" statement is evaluated to true only if the form built-in
validation is successful. Therefore, we will not be able to show any
custom validation messages to the user, until she re-submits the form.
IMHO this is not efficient or intuitive to the user. I would rather have
all the invalid fields displaying the associated error messages and ask
the user to correct them in one go. The code could be restructured like
in the following example:

            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;
	          	validated = false;
              this.isValid = validated;
              finished = this.isValid;

We are using the above fix in our development and we thought it would be
good to have a fix in cocoon so we do not need to patch it every time we
get a new release.


View raw message