cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/forms/samples/forms form1.xml
Date Fri, 07 May 2004 10:55:08 GMT
vgritsenko    2004/05/07 03:55:08

  Modified:    src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript
                        Form.js
               src/blocks/forms/samples/forms form1.xml
  Log:
  Add check for removed form.validator, add form level validation to the sample.
  
  Revision  Changes    Path
  1.9       +6 -1      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js
  
  Index: Form.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Form.js	6 May 2004 14:23:04 -0000	1.8
  +++ Form.js	7 May 2004 10:55:08 -0000	1.9
  @@ -94,6 +94,11 @@
       var finished = false;
       this.isValid = false;
   
  +    // 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.";
  +    }
  +
       do {
           var k = cocoon.sendPageAndWait(uri, bizData);
           if (result == null) result = k;
  
  
  
  1.6       +17 -2     cocoon-2.1/src/blocks/forms/samples/forms/form1.xml
  
  Index: form1.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/forms/form1.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- form1.xml	17 Apr 2004 18:33:56 -0000	1.5
  +++ form1.xml	7 May 2004 10:55:08 -0000	1.6
  @@ -21,7 +21,22 @@
   
   <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
            xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  -  
  +
  +  <fd:validation>
  +    <!-- This demonstrates form level validation -->
  +    <fd:javascript>
  +      var success = true;
  +      var price = widget.getWidget("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>
  +
     <fd:widgets>
       <fd:field id="tab-state">
         <fd:datatype base="string"/>
  
  
  

Mime
View raw message