Add model item properties to UI level

From W3C XForms Group Wiki (Public)

Outline

  • We will allow the MIPs on UI controls.
  • They will create an implicit model with implicit binds and add the MIPs to the bind. If the model is already present that model will be used, if a bind for the specific node(s) already exists the MIPs will be added to that bind. When the same MIP is already present on the bind (an xforms-binding-exception event will be dispatched if the bind already contains the MIP).

Proposed text

6 Model Item Properties

This chapter defines infoset contributions that can be bound to instance data nodes with the bind element (see 3.3.4 The bind Element) and form control (see Form control) elements.

Examples

Assigning a data type to a form control

<xf:input ref="cc" type="xf:card-number">
  <label>...</label>
</xf:input>

generates

<model>
  ...
  <xf:bind nodeset="cc" type="xf:card-number" />
</model>
...
<xf:input ref="cc">
  <label>...</label>
</xf:input>


Assigning MIPs to controls in a container control

<xf:group ref="payment-info">
  ...
  <xf:input ref="cc" type="xf:card-number">
    <label>...</label>
  </xf:input>
</xf:group>

generates

<model>
  ...
  <xf:bind nodeset="payment-info[1]">
    ...
    <xf:bind nodeset="cc" type="xf:card-number" />
  </xf:bind>
</model>
...
<xf:group ref="payment-info">
  ...
  <xf:input ref="cc">
    <label>...</label>
  </xf:input>
</xf:group>


Assigning MIPs to controls in a repeat

<xf:repeat nodeset="payment-info">
  ...
  <xf:input ref="cc" type="xf:card-number">
    <label>...</label>
  </xf:input>
</xf:repeat>

generates

<model>
  ...
  <xf:bind nodeset="payment-info">
    ...
    <xf:bind nodeset="cc" type="xf:card-number" />
  </xf:bind>
</model>
...
<xf:repeat nodeset="payment-info">
  ...
  <xf:input ref="cc">
    <label>...</label>
  </xf:input>
</xf:repeat>


Pending Questions

  • Currently all text related to MIPs is based on the fact that MIPs can only be specified on bind elements (e.g.: All model item properties are initialized by processing all bind elements in document order), we probably don't want to change this. And say something like : A MIP on a form control is a shorthand for creating a bind with the MIP that refers to the bound data node of the form control
    • We probably want to add a note that explains that container form control also need to create binds if it contains form controls with MIPs

Why do we need MIPs on form controls?

There are two reasons why we want to allow model item properties on form controls :

  1. For the easy of authoring when creating simple forms and you are using an implicit instance. When you created your form using lazy creation but now want to add some model item properties (for example types, constraints, ...) it would be nice that you just could add those model item properties to the form controls without the need to create a model element nor a bind element.
  2. When you have a separate model and form UI designer there are cases where the UI designer can add extra model item properties to certain controls that don't need to be enforced by the model (for example extra constraint, stricter type, UI control is read only)