| <?xml version="1.0"?> |
| <wb:context |
| xmlns:wb="http://apache.org/cocoon/woody/binding/1.0" |
| xmlns:wd="http://apache.org/cocoon/woody/definition/1.0" |
| path="/" > |
| |
| <!-- |
| | This file shows the different possibilities for (single) Value Binding |
| | of the Binding Framework in Cocoon Forms (aka Woody). |
| --> |
| |
| |
| <!-- |
| | SECTION 1. Default simple value-binding |
| --> |
| <wb:value id="simple" |
| path="simple" /> |
| |
| |
| <!-- |
| | SECTION 2. Playing around with @direction |
| --> |
| |
| <!-- Binding only during load() --> |
| <wb:value id="readonly" |
| path="readOnly" direction="load"/> |
| |
| <!-- Binding only during save() --> |
| <wb:value id="writeonly" |
| path="writeOnly" direction="save"/> |
| |
| <!-- Binding working to different targets for |
| load() and save() --> |
| <wb:value id="diff" |
| path="diffIn" direction="load"/> |
| <wb:value id="diff" |
| path="diffOut" direction="save"/> |
| |
| |
| <!-- |
| | SECTION 3. Using the 'on-update' |
| --> |
| |
| <!-- Binding executing additional action on save() |
| if the value changed --> |
| <wb:value id="onupdate" |
| path="onUpdate" > |
| <wb:on-update> |
| <wb:javascript id="onupdate" path=".."> |
| <wb:load-form /> |
| <wb:save-form> |
| var countPointer = jxpathContext.getPointer('updateCount'); |
| var count = parseInt(countPointer.getValue()) + 1; |
| countPointer.setValue(count); |
| </wb:save-form> |
| </wb:javascript> |
| </wb:on-update> |
| </wb:value> |
| |
| |
| <!-- |
| | SECTION 4. Matching value types and data-conversion |
| --> |
| |
| <!-- Boolean Binding just works --> |
| <wb:value id="bool" |
| path="bool"> |
| <wd:convertor datatype="boolean" /> |
| </wb:value> |
| |
| <!-- Converting data-types to/from String values --> |
| <wb:value id="date" |
| path="date" > |
| <wd:convertor datatype="date" > |
| <wd:patterns> |
| <wd:pattern>yyyyMMdd</wd:pattern> |
| </wd:patterns> |
| </wd:convertor> |
| </wb:value> |
| |
| </wb:context> |