home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / 01value-bind.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  2.8 KB  |  97 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17.  
  18. <fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" 
  19.             xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
  20.         path="/" >
  21.  
  22. <!-- 
  23.    | This file shows the different possibilities for (single) Value Binding 
  24.    | of the Binding Framework in Cocoon Forms.
  25.    -->
  26.  
  27.  
  28.   <!-- 
  29.      | SECTION 1. Default simple value-binding 
  30.      -->
  31.   <fb:value id="simple"   
  32.             path="simple" />
  33.             
  34.  
  35.   <!-- 
  36.      | SECTION 2. Playing around with @direction
  37.      -->
  38.  
  39.   <!-- Binding only during load() -->
  40.   <fb:value id="readonly"   
  41.             path="readOnly" direction="load"/>
  42.             
  43.   <!-- Binding only during save() -->          
  44.   <fb:value id="writeonly"   
  45.             path="writeOnly" direction="save"/>
  46.             
  47.   <!-- Binding working to different targets for 
  48.        load() and save() -->
  49.   <fb:value id="diff"   
  50.             path="diffIn" direction="load"/>            
  51.   <fb:value id="diff"   
  52.             path="diffOut" direction="save"/>
  53.             
  54.             
  55.   <!-- 
  56.      | SECTION 3. Using the 'on-update'
  57.      -->
  58.                
  59.   <!-- Binding executing additional action on save()
  60.        if the value changed -->          
  61.   <fb:value id="onupdate"   
  62.             path="onUpdate" >
  63.     <fb:on-update>
  64.       <fb:javascript id="onupdate" path="..">
  65.         <fb:load-form />
  66.         <fb:save-form>
  67.           var countPointer = jxpathContext.getPointer('updateCount');
  68.           var count = parseInt(countPointer.getValue()) + 1;
  69.           countPointer.setValue(count);
  70.         </fb:save-form>
  71.       </fb:javascript>
  72.     </fb:on-update>          
  73.   </fb:value>
  74.             
  75.             
  76.   <!-- 
  77.      | SECTION 4. Matching value types and data-conversion
  78.      -->
  79.             
  80.   <!-- Boolean Binding just works -->          
  81.   <fb:value id="bool"   
  82.             path="bool">
  83.     <fd:convertor datatype="boolean" />
  84.   </fb:value>
  85.                         
  86.   <!-- Converting data-types to/from String values -->
  87.   <fb:value id="date"   
  88.             path="date" >
  89.     <fd:convertor datatype="date" >
  90.       <fd:patterns>
  91.         <fd:pattern>yyyyMMdd</fd:pattern>
  92.       </fd:patterns>
  93.     </fd:convertor>
  94.   </fb:value>
  95.   
  96. </fb:context>
  97.