coliver     2004/01/30 11:21:35

  Modified:    src/blocks/woody/samples/v2 form1_template.xml
                        woody_flow_example.js
  Log:
  Added example of setting properties on a widget and accessing them in the view
  
  Revision  Changes    Path
  1.2       +15 -7     cocoon-2.1/src/blocks/woody/samples/v2/form1_template.xml
  
  Index: form1_template.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/woody/samples/v2/form1_template.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- form1_template.xml        28 Jan 2004 18:32:32 -0000      1.1
  +++ form1_template.xml        30 Jan 2004 19:21:35 -0000      1.2
  @@ -1,10 +1,11 @@
   <?xml version="1.0"?>
  -<!-- The only difference between this file and the form1_template_action.xml
  -     is the value of the action attribute on the wt:form-template element -->
  -<page xmlns:wt="http://apache.org/cocoon/woody/template/1.0"; 
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0";>
  +
  +<page xmlns:wt="http://apache.org/cocoon/woody/template/1.0"; 
  +      xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"; 
  +      xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
     <title>Sample form</title>
     <content>
  -    <wt:form-template action="#{$continuation/id}.continue" method="POST">
  +    <wt:form-template action="${cocoon.continuation.id}.continue" 
method="POST">
       <table align="center">
        <tr><td>
        
  @@ -58,7 +59,6 @@
                 </wi:items>
               </wi:group>
               
  -            <p>Checkout the <a href="form1">form1 action page</a> for 
another way of formatting panels</p>
   
         <wi:group>
           <wi:styling layout="columns"/>
  @@ -71,6 +71,11 @@
           </wi:items>
         </wi:group>
   
  +      <!-- It's possible to access repeater rows using jx like this: -->
  +      <jx:forEach varStatus="loop" begin="0" end="${contacts.length - 1}">
  +          <jx:set var="row" value="${contacts.getRow(loop.index)}"/>
  +          <!-- do something with row... -->
  +      <jx:forEach/>
   
         <!-- manual layout of fieldw, without use of a wi:group -->
         <wt:widget-label id="contacts"/><br/>
  @@ -103,8 +108,11 @@
             </td>
           </tr>
         </table>
  -
  -      <input type="submit"/>
  +      <!-- 
  +           You can access properties you set on the form or other widgets 
  +           using jx: 
  +      -->
  +      <input type="submit" value="${buttonName}"/>
        </td></tr>
       </table>
       </wt:form-template>
  
  
  
  1.2       +8 -1      
cocoon-2.1/src/blocks/woody/samples/v2/woody_flow_example.js
  
  Index: woody_flow_example.js
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/woody/samples/v2/woody_flow_example.js,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- woody_flow_example.js     28 Jan 2004 18:32:32 -0000      1.1
  +++ woody_flow_example.js     30 Jan 2004 19:21:35 -0000      1.2
  @@ -140,8 +140,15 @@
       // A MultiValue widget can be initialized using an array:
       //
       wid.drinks.value = ["Jupiler", "Coca Cola"];
  +
       //
  -    // showForm() sends the form to the browser and doesn't return
  +    // You can set additional properties on any widget that will
  +    // be accessible in the pipeline (e.g. with JXTemplateGenerator)
  +    //
  +    wid.buttonName = "Commit";
  +
  +    //
  +    // showForm() repeatedly sends the form to the browser and doesn't return
       // until validation is complete.
       //
       form.showForm("form1-display-pipeline");
  
  
  

Reply via email to