W3C home > Mailing lists > Public > public-xformsusers@w3.org > June 2017

Alert MIP Proposal

From: Steven Pemberton <steven.pemberton@cwi.nl>
Date: Wed, 21 Jun 2017 09:51:10 +0200
To: " XForms" <public-xformsusers@w3.org>
Message-ID: <op.y16arkflsmjzpq@steven-xps>
It seems to me that the Alert text of an Alert on a control really belongs
with the data in most cases. As it currently is, the message and the
condition are far apart.

Therefore a proposal.

====
The Alert Property

This property associates an alert message with a constraint or type model
binding.

Computed Expression: Yes.

Legal Values: Any string expression.

Default Value: none.

Inheritance Rules: does not inherit.

Description

This associates a message expression with a type or constraint property of
a node. If a control is bound to the node, and the node is non-valid as a
result of the type requirements or constraint, then the associated message
is evaluated, and displayed as if a part of an <code>alert</code> element
on the control.

Examples

<bind ref="age" type="integer" alert="'Must be a whole number'"/>
<bind ref="age" constraint=". &gt;= 0" alert="'Must be greater than
zero'"/>

<bind ref="wish" constraint="count(../wish) &lt; 4" alert="'You can't have
more than 3 wishes'"/>

<bind ref="card" type="card-number" constraint="cardnumber(.)"
          alert="'Not a valid card number'"/>

<bind ref="card" type="card-number" constraint="cardnumber(.)"
             alert="instance('messages')/cardnumber"/>

<bind ref="pin-code" constraint="matches(., '^\d{4}$')" alert="'must be 4
digits'"/>

====

Steven
Received on Wednesday, 21 June 2017 07:51:47 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 21 June 2017 07:51:48 UTC