cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Snowdon" <Phil.Snow...@ird.govt.nz>
Subject [CForm] javascript validation doesn't work?
Date Tue, 03 Aug 2004 21:08:51 GMT
Take this snippet from the samples.  Supposedly if the price is
less than one, then it will show a validation error.  It
doesn't.

 <fd:validation>
    <!-- This demonstrates form level validation -->
    <fd:javascript>
      var success = true;
      var price = widget.lookupWidget("dieselprice");
      if (price.value &lt; 1) {
          price.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("It
can not be that low!", false));
          success = false;
      }
      
      // Must return true/false
      return success;
    </fd:javascript>
  </fd:validation>

even simpler

  <fd:validation>
    <fd:javascript>
      return false;
    </fd:javascript>
  </fd:validation>

Which should always generate a validation error doesn't seems to
either.

Is this a known issue?  There's a comment in the Form.js code
    // FIXME: Remove check for removed syntax later.
    if (this.validator != undefined) {
        throw "Forms do not support custom javascript validators
anymore. Declare your validators in the form model file.";
    }

Does this mean that we can't use javascript validadtors anymore.
 What does it mean by declaring your validators in the form model
file?

Cheers

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message