Re: Xforms Validation

Well, I found out I could use the number() function to be sure the user enter an integer only, doing like this:

<xforms:bind xforms:id="bind_2" nodeset="instance('instance_0')/champ2" type="xs:integer" constraint="number()&gt;0" required="true()"/>

On the others end, I tried adding the xs name space and didn't notice any change, but it make the Xforms more coherent.

I am still looking for a way to use regular expressions if you have any idea.

Thans for your replies
Best regards

Pierre
---
         Pierre Busnel    

--------- Original Message ---------

DATE: Thu, 27 May 2004 09:39:57
From: Robert Bateman <bobbateman@sequoiallc.com>
To: www-forms@w3.org
Cc: 

>
>Pierre,
>
>I'm not an XForms expert....  But, I think I noticed a possible typo in your 
>code...
>
>In
>
><xforms:bind xforms:id="bind_1" nodeset="instance('instance_0')/champ1"
>  type="xs:integer" constraint="string-length()=2" required="true()"/>
>
>You are "typing" your bing to xs:integer     But I don't see the XS name space 
>declared.  Is it possible that should be xsd:integer?
>
>I don't know if it makes a difference at the <instance> level, but my xforms 
>code has types in my instance variables as well (atleast those that are *not* 
>declared in a schema.)
>
>Hope this helps!
>
>Bob
>
>On Thursday 27 May 2004 08:20 am, Pierre Busnel wrote:
>>   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 !!
>>
>
>

Received on Friday, 28 May 2004 03:16:21 UTC