- From: Roman Huditsch <roman.huditsch@hico.com>
- Date: Thu, 27 May 2004 14:30:02 +0200
- To: <pierre2803@lycos.com>, <www-forms@w3.org>
- Message-ID: <49131F069C24E34AB497B1803F732AFB06797F@hicoetsrv000006.hico.local>
Hi Pierre,
I think the problem lies within your bind-expression, or the "type" attribute to be mor precise.
You defined a namespace "http://www.w3.org/1999/XMLSchema" with the prefix "xsd", but within your type
attribute you are using an "xs" prefix.
Your bind should read:
<xforms:bind id="bind_1" nodeset="instance('instance_0')/champ1" type="xsd:integer" constraint="string-length()=2" required="true()"/>
BTW, I don't think it is necessary to qualify your id and bind attributes.
wbr,
Roman
Mag.(FH) Roman Huditsch (hRHU )
Technical Consultant & Trainer
_____________________________________________________________________
hico Informations- und Kommunikations-Management Gesellschaft m.b.H.
TechLab, Thomas A. Edison Straße 2.
A-7000 Eisenstadt / Austria
phone: +43/2682/704-61-72; fax: +43/2682/704-71-61-10
e-mail: roman.huditsch@hico.com
mobile: +43/664/4102715
-----Ursprüngliche Nachricht-----
Von: Pierre Busnel [mailto:pierre2803@lycos.com]
Gesendet: Donnerstag, 27. Mai 2004 14:21
An: www-forms@w3.org
Betreff: Xforms Validation
Hi,
I've been trying in vain to add constraints to a xforms. What I am trying to do is to make sure the user will enter an integer in a certain field. I found easy to test the length of a field or others things using Xpath functions, but I dont see how I can test the type or how I can use regular expressions.
In the code below, the user can enter a 2 characters string, even if the type is an integer. How can I prevent the user from entering anything else than numbers ?
Regards
Pierre Busnel
PS: By the way, I think Xforms is the "next big thing". Or I'll be damned to try to understand how it works for nothing !!
--- controls.xforms ---
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<head>
<link rel="stylesheet" type="text/css" href="xforms.css" /> <xforms:model xforms:id="model_0"> <xforms:instance xforms:id="instance_0"> <liste>
<champ1/>
</liste>
</xforms:instance>
<xforms:bind xforms:id="bind_1" nodeset="instance('instance_0')/champ1" type="xs:integer" constraint="string-length()=2" required="true()"/>
<xforms:submission action="http://192.168.9.12:8080/xform/app" method="post" id="submit" /> </xforms:model> </head> <body>
<xforms:input xforms:bind="bind_1">
<xforms:label>Champ 1</xforms:label>
</xforms:input>
<xforms:trigger>
<xforms:label>Submit</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:message ev:event="xforms-invalid" level="modal"> invalid field </xforms:message>
<xforms:send submission="submit"/>
</xforms:action>
</xforms:trigger>
</body>
</html>
Received on Thursday, 27 May 2004 09:05:39 UTC