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

Re: making an xsd:date field optional

From: John Boyer <boyerj@ca.ibm.com>
Date: Fri, 28 May 2010 09:23:49 -0700
To: Jabba Laci <jabba.laci@gmail.com>
Cc: xforms <www-forms@w3.org>, www-forms-request@w3.org
Message-ID: <OF898D3795.613AD370-ON88257731.00598109-88257731.005A14F8@ca.ibm.com>
Hi Jabba,

Rather than xsi:type, you could use 

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


<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.

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: 

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


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>


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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:23 UTC