Re: making an xsd:date field optional

Hi Jabba,

Rather than xsi:type, you could use 

<bind nodeset="limiteValidite" type="date"/> <!-- assumes xforms is 
default namespace -->

or 

<xforms:bind nodeset="limiteValidite" type="xforms:date"/>  <!-- if xforms 
namespace is not the default -->

You could also use xsi:type="xforms:date" as well, but it's less practical 
because it assumes the schema for your instance data knows about 
xforms:date, which may be OK for the client-side but perhaps not 
server-side validation of the result.

In any case, the point of the xforms-namespaced datatypes in Section 5 of 
the spec is to account for the fact that XML schema is about the finished 
product, whereas XForms is about the fill experience.  It may have been OK 
for XML schema to leave empty string out of the lexical space of dates, 
integers and so forth, but it's not really OK for describing types used 
during interaction with the end-user providing the data.

Any time you need a basic datatype from XML schema, consider using its 
XForms equivalent.  Then, if you do need to make the data required to 
fill, you can use the XForms "required" model item property to express 
that necessity.

Cheers,
John M. Boyer, Ph.D.
STSM, Lotus Forms
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed: 
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw





From:
Jabba Laci <jabba.laci@gmail.com>
To:
xforms <www-forms@w3.org>
Date:
05/27/2010 05:36 PM
Subject:
making an xsd:date field optional



Hi,

I have a form with an input field which asks for a date (using
xsd:date). However, if it's left empty, the form cannot be sent. How
to make it optional? Here is what I have:

Model part:

<limiteValidite xsi:type="xsd:date" />

Body part:

<xforms:input ref="/Nouvelle/limiteValidite">
   <xforms:label>Date limite de la validite :&nbsp;</xforms:label>
   <xforms:message level="ephemeral" ev:event="DOMFocusIn">Saisissez
une date.</xforms:message>
</xforms:input>

Thanks,

Laszlo

Received on Friday, 28 May 2010 16:24:39 UTC