W3C home > Mailing lists > Public > www-forms@w3.org > January 2006

RE: XForms: how to disable the use of the XML Schema?

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Tue, 10 Jan 2006 11:23:25 -0000
Message-ID: <D302DE1D-E395-4243-BC8D-E7BCCD2B78D5@s15.mail.x-port.net>
To: <Olivier.Gaillard@bit.admin.ch>
Cc: <www-forms@w3.org>, <formsPlayer@yahoogroups.com>

Hi Olivier,
[Cross-posting to both lists since you asked the question on both lists :)]
Please take a look at the wiki entry TutorialNillable:
You'll see that the bit you need to add is the second step:

As to the integer problem, there was a bug in formsPlayer whereby the
display was not always updated correctly to reflect the model's state. The
bug would show itself by updating the error state on the next refresh, so if
this is the cause of your problem you would see your control displayed as
invalid after you edit some other data.
This bug was fixed in recent versions of 1.4. Installation is now via CAB
files, and you can ensure that you and your users are upgraded automatically
by changing the object tag in your documents to this:
  <object id="formsPlayer" width="0" height="0"
If a user has a version less than the one in @codebase they will be asked if
they want to upgrade to the latest version.
Version 1.4 includes a number of changes to comply with XForms 1.0 Second
Edition, so we recommend checking wiki entry Xforms10SecondEdition before
you go deploying it to your users, since it may require changes to your

Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
b: http://internet-apps.blogspot.com/
w: http://www.formsPlayer.com/

Download our XForms processor from



	From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Olivier.Gaillard@bit.admin.ch
	Sent: 10 January 2006 08:24
	To: www-forms@w3.org
	Subject: XForms: how to disable the use of the XML Schema?

	I use an XForms whose validation is driven by an XML Schema.
	I'd like to disable the validation on-demand for some elements,
	we need to save the data even with empty or not valid values 
	(reason is that we have mostly no rights to edit the data of 
	a client).
	I followed the solution explained by Micah Dubinko in "XForms
	Essentials" pp. 171--172: the controls "Allow Empty PLZ" and "Empty
	PLZ not allow" switch the value of the attribute "required" of
	"plz" (ZIP) to "true" or "false".
	All works fine for *empty* values if the XML Schema definition is a
	string and if empty strings are allowed:
	<xs:restriction base="xs:string">
	   <xs:pattern value="([0-9]{4})?"/>
	But if the pattern of the XML Schema does not contain the optional
	sign `?' an empty string is not allowed.
	If the definition is changed to integer:
	<xs:element name="codePostal" type="xs:integer" nillable="true"
	and if the ZIP value is empty, there is no validation error (the
	control does not become red), but I get an error message when I
	the form, complaining that the value of ZIP is not an integer.
	As non valid data must be saved the solution cannot come from the
	Schema but from XForms.
	Question: Is it possible to disable the use of the XML Schema?
	<?xml version="1.0" encoding="ISO-8859-1"?>
	<html xmlns:xf="http://www.w3.org/2002/xforms
<http://www.w3.org/2002/xforms> " 
<http://www.w3.org/2001/XMLSchema> " 
<http://www.w3.org/2001/xml-events> " 
<http://www.w3.org/1999/xhtml> ">
	      <object classid="CLSID:4D0ABA11-C5F0-4478-991A-375C4B648F58"
	      <?import namespace="xf" implementation="#formsPlayer"?>
	 <style type="text/css">
	       background-color: red;
	    body {background: floralwhite}
	  <xf:model id="m1" schema="./app4b.xsd"> 
	   <xf:instance src="./app4b.xml" />
	   <xf:bind id="villeNom"
nodeset="/form/data/adresse/ville/villeNom" />
	   <xf:bind id="plz" nodeset="/form/data/adresse/ville/codePostal" 
	    required="instance('strict_flag')" />
	   <xf:submission action="xformsHandler.html"
	                                encoding="ISO-8859-1" id="submit"
method="post" /> 
	      <xf:submission id="fsubmit" replace="instance" 
	                                encoding="ISO-8859-1"  method="put"
	   <xf:instance id="strict_flag">
	      <!-- Formular -->
	 <xf:input bind="villeNom">
	      <xf:input bind="plz">
	       <xf:label>Allow empty ZIP</xf:label>
	       <xf:action ev:event="DOMActivate">
	  <xf:setvalue ref="instance('strict_flag')">false</xf:setvalue>
	       <xf:label>Empty ZIP not allow</xf:label>
	       <xf:action ev:event="DOMActivate">
	  <xf:setvalue ref="instance('strict_flag')">true</xf:setvalue>
	     <xf:label>Must ZIP be filled?
	       <b><xf:output ref="instance('strict_flag')"></xf:output></b>
	      <xf:submit submission="fsubmit">
	 <xf:label>Write to disk</xf:label>
	Here's the XML instance:
	<?xml version="1.0" encoding="iso-8859-1"?>
	Thanks in advance for your help,
Received on Tuesday, 10 January 2006 11:23:44 UTC

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