Re: Applying multiple binds to an element...

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 UTC