W3C home > Mailing lists > Public > www-forms@w3.org > January 2002

Creating, editing and viewing of data

From: Naresh Bhatia <NBhatia@sapient.com>
Date: Mon, 21 Jan 2002 09:04:36 -0500
Message-ID: <FDC3B7209AC0DB46AD9BAC16B43646B1024D189E@cammmsx01.sapient.com>
To: www-forms@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:50 GMT