Creating, editing and viewing of data

I have a very basic question about XForms. Suppose I want the capability to
create, edit and view some data. For these 3 common operations, I assume
that I would have to create 3 different forms, which are very similar to
each other, but not the same. Is this assumption correct? Moreover, these
forms would probably be generated dynamically based on the mode (create,
edit or view).

For example:

***** Creating Payment Data *****
Here the instance data contains default values only.
<xforms:model>
  <xforms:instance>
    <payment as="credit" xmlns="http://commerce.example.com/payment">
      <cc/>
    </payment>
  </xforms:instance>
  <xforms:submitInfo action="http://example.com/submit" method="post"/>
</xforms:model>

<selectOne ref="my:payment/@as">  ... </selectOne>
<input ref="my:payment/my:cc">  ... </input>

***** Editing Payment Data *****
Here the instance data contains persisted values for each field in the
structure.
<xforms:model>
  <xforms:instance>
    <payment as="credit" xmlns="http://commerce.example.com/payment">
      <cc>123456789012345</cc>
    </payment>
  </xforms:instance>
  <xforms:submitInfo action="http://example.com/submit" method="post"/>
</xforms:model>

<selectOne ref="my:payment/@as">  ... </selectOne>
<input ref="my:payment/my:cc">  ... </input>

***** Viewing Payment Data *****
Here the instance data contains persisted values for each field in the
structure and all the fields are constrained to be readOnly.
<xforms:model>
  <xforms:instance>
    <payment as="credit" xmlns="http://commerce.example.com/payment">
      <cc>123456789012345</cc>
    </payment>
  </xforms:instance>
  <xforms:submitInfo action="http://example.com/submit" method="post"/>
  <xforms:bind ref="my:payment/@as" readOnly="true"/>
  <xforms:bind ref="my:payment/my:cc" readOnly="true"/>
</xforms:model>

<selectOne ref="my:payment/@as">  ... </selectOne>
<input ref="my:payment/my:cc">  ... </input>

Naresh Bhatia
Sapient
One Memorial Drive, Cambridge, MA 02142
Tel: 617-761-1771  Fax: 617-621-1300
Email: nbhatia@sapient.com

Received on Monday, 21 January 2002 09:05:08 UTC