You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2003/07/25 11:01:40 UTC

cvs commit: cocoon-2.1/src/blocks/woody/samples/forms form2_template.xml

bruno       2003/07/25 02:01:40

  Added:       src/blocks/woody/samples/forms form2_template.xml
  Log:
  replaces the previous from2_template.xsp
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/woody/samples/forms/form2_template.xml
  
  Index: form2_template.xml
  ===================================================================
  <?xml version="1.0"?>
  <page xmlns:wt="http://apache.org/cocoon/woody/template/1.0">
    <title>Sample form</title>
    <content>
      <p>This form is used to illustrate the Woody binding framework. The binding
        is based on JXPath and hence works both with XML documents and beans.
        Some warnings and limitations of the current implementation:</p>
      <ul>
        <li>In the repeater (the list of contacts), you should not modify the id
          column. For newly added rows leave the id blank, for existing rows do
          not modify it. In the future this will become a hidden and read-only
          widget. Other repeater-binding strategies that do not depend on an id
          field could of course be created.</li>
        <li>the email address is marked in the binding as "read-only", meaning it
          will only be bound from bean/xml to form, but not in the other
          direction. So you won't see it changed in the bean or the XML.</li>
        <li>The binding doesn't support all widget types yet (e.g. the
          multivaluefield is currently not yet supported).</li>
        <li>Note how, in the XML binding, the date is formatted according XML
          Schema date format in the XML, while it is displayed in another format
          to the user, and is stored in the form model as a Java Date
          object (useful for date-specific validations).</li>
      </ul>
      <p>If you're running the XML-binding demo, then after successful submit
        you'll see the updated XML.</p>
      <p>If you're running the bean-binding demo, then after successful submit
        you'll be shown a page that uses the JXTemplateGenerator to extract
        data from the bean (to show that the bean really has been updated).</p>
      <wt:form-template action="#{$continuation/id}.continue" method="POST">
        <table border="1">
          <tr>
            <td valign="top"><wt:widget-label id="email"/></td>
            <td valign="top"><wt:widget id="email"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="phone"/></td>
            <td valign="top"><wt:widget id="phone" /></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="ipaddress"/></td>
            <td valign="top"><wt:widget id="ipaddress"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="birthday"/></td>
            <td valign="top"><wt:widget id="birthday"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="number"/></td>
            <td valign="top"><wt:widget id="number"/></td>
          </tr>
        </table>
  
        <wt:widget-label id="contacts"/><br/>
        <wt:repeater-size id="contacts"/>
        <table border="1">
          <tr>
            <th>(id)</th>
            <th><wt:repeater-widget-label id="contacts" widget-id="firstname"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="lastname"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="phone"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="email"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="select"/></th>
          </tr>
  
          <!-- The contents of the repeater-widget element is a template that will
          be applied to each row in the repeater. -->
          <wt:repeater-widget id="contacts">
            <tr>
              <td>[<wt:widget id="id"/>]</td>
              <td><wt:widget id="firstname"/></td>
              <td><wt:widget id="lastname"/></td>
              <td><wt:widget id="phone"/></td>
              <td><wt:widget id="email"/></td>
              <td><wt:widget id="select"/></td>
            </tr>
          </wt:repeater-widget>
  
          <tr>
            <td colspan="4" align="right">
              <wt:widget id="addcontact"/>
              <wt:widget id="removecontacts"/>
            </td>
          </tr>
        </table>
  
        <input type="submit"/>
      </wt:form-template>
    </content>
  </page>