W3C home > Mailing lists > Public > www-forms@w3.org > May 2004

Re: Applying multiple binds to an element...

From: Roland Merrick <roland_merrick@uk.ibm.com>
Date: Wed, 5 May 2004 10:00:49 +0100
To: "Dan G. Switzer, II" <dswitzer@pengoworks.com>
Cc: www-forms@w3.org, www-forms-request@w3.org
Message-ID: <OF5CAEEAF1.22DFD602-ON80256E8B.002F3149-80256E8B.0031578E@uk.ibm.com>
Greetings, what you have shown below will not work in XForms 1.0, an 
xforms-binding-exception event will be dispatched and processing will halt 
[1] as part of initial construction.

Only one instance of any given Model Item Property can be specified for a 
node. So your sense that "It doesn't seem right to have the required 
property on both" was correct. Unfortunately it also applied to the type 
attribute. 

One possible solution to your problem would be to specify a type attribute 
referring to an XML Schema type and to express your second constraint 
using the XForms MIP constraint attribute.

For example:
<xform:bind 
                 ref="//xform:model/xf:instance/homePhone"
                 required="true"
                 type="valid:PHONE"
                 />
<xform:bind 
                 ref="//xform:model/xf:instance/homePhone"
                 constraint=". . . xpath expression . . ."
                 />

[1] http://www.w3.org/TR/xforms/slice4.html#evt-modelConstruct

Regards, Roland




"Dan G. Switzer, II" <dswitzer@pengoworks.com> 
Sent by: www-forms-request@w3.org
05/05/2004 01:12

To
<www-forms@w3.org>
cc

Subject
Applying multiple binds to an element...







What's the best way to output multiple validations to the same element 
using
bind statements? I have a case where a user might apply multiple 
validation
rules (like is it a phone number and does it match a pattern.) 

For example:
<xform:bind 
                 ref="//xform:model/xf:instance/homePhone"
                 required="true"
                 type="valid:PHONE"
                 />
<xform:bind 
                 ref="//xform:model/xf:instance/homePhone"
                 required="true"
                 type="valid:REGEX"
                 />

It doesn't seem right to have the required property on both. Is there a
better way to approach this--without combining my two validation 
procedures
into one?

Thanks,
Dan
Received on Wednesday, 5 May 2004 04:59:49 GMT

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