W3C home > Mailing lists > Public > www-forms@w3.org > April 2005

WXS types in XForms

From: Alexander Anokhin <ava@vaz.ru>
Date: Fri, 08 Apr 2005 12:06:02 +0500
Message-ID: <42562D5A.9040002@vaz.ru>
To: www-forms@w3.org
Hello, all.

I'm trying to assign some validation job to XForms.
For example: I want to bind <xform:input> with such WXS-type when it's 
value is decimal with maximum 5 digits OR user may leave this field 
empty (kind of optional search parameter).
My guess, is that i'll be like this:
             <xsd:simpleType name="myType">
                 <xsd:restriction base="xsd:decimal">
                     <xsd:minInclusive value="0"/>
                     <xsd:fractionDigits value="5"/>
                 </xsd:restriction>
             </xsd:simpleType>
but when such field is empty (right after Xform is loaded or user 
desided that way) it fires xforms-invalid event and so on..

I did some workaround by using <xsd:pattern>:

             <xsd:simpleType name="myType">
                 <xsd:restriction base="xsd:string">
                     <xsd:pattern value="[0-9]{1,5}|"/>
                 </xsd:restriction>
             </xsd:simpleType>

Works fine but, imho, not such pretty.

I'm not an WXS expert so is there better way?


-- 
Alexander Anokhin
AVTOVAZ JSC
email: ava@vaz.ru
icq: 123275798

Received on Friday, 8 April 2005 07:06:08 GMT

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