List of articles   Colour designations   Choose language


Unification of WebForms2 and XForms



Transfer of mechanism of WebForms (repetition of html-elements) into XForms (hiding-showing)

WebForms2 gives possibility to duplicate html-element (with elements, enclosed into it). Attribute repeat can be added to any element (and attributes repeat-start, repeat-min, repeat-max, accompanying to it).

<tr id="order" repeat="template">
  <td><input type="text" name="row[order].product"></td>
  <td><input type="text" name="row[order].quantity"></td>
  <td><button type="remove">Remove This Row</button></td>
</tr>
<tr>
  <td><button type="add" template="order">Add Row</button></td>
</tr>

In purpose of unification and simplification, i offer for demonstration of alternatives.

Select payment method: Cash
Credit card
Time at home
Select payment method: Cash
Credit card
Credit card number
Expiration date
to use mechanism, applied in WebForms, instead XForms
<tr id="ecommerce">
  <td><input type="text" name="number"></td>
  <td><input type="text" name="expire"></td>
</tr>
<tr>
  <td><input type="radio" name="method" value="cc"
       template="ecommerce">Credit card</td>
</tr>
and
<tr id="ecommerce">
  <td><input type="text" name="number"></td>
  <td><input type="text" name="expire"></td>
</tr>
<tr>
  <td><input type="checkbox" name="method" value="cc"
       template="ecommerce">Credit card</td>
</tr>
because mechanism of XForms is too sophisticated, burdened by two artificial manners: 'binding' and 'constraining values'. Both these manners over-sophisticate and should be used optional. Besides that, restriction of values is already developed in WebForms2 (attribute pattern and new values of attribute type of tag input), and there is no necessity to dublicate these possibilities.

<xforms:model>
  <xforms:instance>
    <ecommerce xmlns="">
      <method/>
      <number/>
      <expiry/>
    </ecommerce>
  </xforms:instance>
  <xforms:submission action="http://example.com/submit" method="post" id="submit"/>

  <xforms:bind nodeset="/payment/number" relevant="/payment/@method = 'cc'">
  <xforms:bind nodeset="/payment/expiry" relevant="/payment/@method = 'cc'">
</xforms:model>

<select1 ref="method">Select Payment Method:
  <item>Cash <value>cash</value> </item>
  <item>Credit <value>cc</value> </item>
</select1>
<input ref="number">Credit Card Number</input>
<input ref="expiry">Expiration Date</input>
<submit submission="submit">Submit</submit>

Filling of WebForms from database

WebForms in existing state allows only to duplicate html-element, but not to fill duplicated copies by values, entered earlier through this document into some database. I offer to add this possibility and to enter attributes repeat-data (specifies identifier of element data with data) and repeat-right (specifies name of attribute, containing rights of access to record, e.g, value read of attribute means, that fields of record are inaccessible to edit, and it's impossible to delete record itself by <button type=remove>). Accordingly value of attribute repeat-start should be interpreted as quantity of empty (not filled) html-elements, existing besides those, which are filled by attribute repeat-data.

<tr id="order" repeat-data="records" repeat-right="r">
  <td><input type="text" name="product"></td>
  <td><input type="text" name="quantity"></td>
  <td><button type="remove">Remove This Row</button></td>
</tr>
<tr>
  <td><button type="add" template="order">Add Row</button></td>
</tr>

<data id="records">
  <order product="Tom figurine"   quantity="12" r="read">
  <order product="Jerry figurine" quantity="5"  r="operate">
</data>

Any user, who enter data, needs right to update, because he can make mistake during inserting values. Anyone, who update fields, can write senseless values or assign "null" into them - both that, and another is equivalent to deleting of record. Right to update without right to read is looks very strange. Therefore right to update is senseless without rights to delete and to read and should be complemented by them - we shall name such whole right as right to operate (operate = update + delete + read).

Sending to server: value in tag or in attribute

For comportability with database of server, WebForms2 should send the same constructions (<order product= quantity= >), which browser was receive (practice of indexes in xml-constructions primaraly perverted, irrelevance).

<order product="Tom figurine"   quantity="12>
<order product="Jerry figurine" quantity="5">
XForms discords with this format of sending

<ecommerce>
  <method>cc</method>
  <number>1235467789012345</number>
  <expiry>2001-08</expiry>
</ecommerce>
In purpose of unification, i offer to use only one of format for coding. Since variant of XForms goes into cut with practice of database, i offer to use format, applied in WebForms, in XForms
<ecommerce method="cc" number="1235467789012345" expiry="2001-08">

Sending to server: name of sending tag

In spite of the fact, that XForms copies value of attribute id=ecommerce into name of tag (ecommerce), WebForms2 should does not send the same, i.e.

<tr id="ord" repeat-data="records" repeat-right="r">
will send
<order product="Tom figurine"   quantity="12>
<order product="Jerry figurine" quantity="5">
instead of ORD

<ord product="Tom figurine"   quantity="12>
<ord product="Jerry figurine" quantity="5">



Dmitry Turin



List of articles   Colour designations   Choose language


Hosted by uCoz