W3C home > Mailing lists > Public > www-forms@w3.org > November 2003

RE: xform validations problems

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Thu, 27 Nov 2003 08:46:36 -0000
To: "'Raghu Krishnamurthy'" <raghu.krishnamurthy@oracle.com>, <www-forms@w3.org>
Message-ID: <001701c3b4c2$fa3e5530$6b01a8c0@W100>
Hello Raghu,
 
If you have data that can be EITHER empty OR a date, then you must make
it 'nillable'. This is an oft asked question on our Yahoo! group, so if
you don't mind I'll just refer you to one of my previous answers ;-):
 
    <http://groups.yahoo.com/group/formsPlayer/message/511>
 
 
Whilst I'm here, I hope you don't think it's rude if I make a few
comments on your code:
 
* @rows and @columns are not part of xf:textarea - you should really use
CSS
* Why the h:span inside the xf:label? That makes that part of your form
less portable. You could put @style on the label.
 
Best regards,
 
Mark
 
 
Mark Birbeck
CEO and CTO
x-port.net Ltd.
 

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Raghu Krishnamurthy
Sent: 27 November 2003 06:16
To: www-forms@w3.org
Subject: xform validations problems
Importance: High


All 

I have an xforms document that has a few text fields. 
The different validations are that textbox1 should be mandatory, 
textbox2 should be only a date and textbox3 should contain less than 10
characters. 


I have the constraints defined thus 
<xforms:bind nodeset="/my:Eform/my:Summary" required="true()"
id="bind_1"/> 
<xforms:bind nodeset="/my:Eform/my:Referral.Rejected.-.Reasons"
id="bind_8" type="xsd:date" format="YYYY-MM-DD"/> 
<xforms:bind nodeset="/my:Eform/my:Desired.Outcome.of.the.Service"
id="bind_4" constraint="string-length( normalize-space(.) ) &lt; 
10"/> 


The ui would be as follows 
<xforms:textarea id="input_0" rows="1" cols="80"
ref="/my:Eform/my:Summary"> 
                                <xforms:label id="label_1"><span
style="color:#ff0000;font-weight:700">Summary</span></xforms:label> 
                                <xforms:message
ev:event="xforms-invalid"> 
                                         This is a mandatory field 
                                </xforms:message> 
</xforms:textarea> 


Now the problem I have is that as you can see in the 
<xforms:message ev:event="xforms-invalid"> 
            This is a mandatory field 
</xforms:message> 


the event gets fired whenever the instance is invalid. 
This is fine,but when the form is displayed for the first time to the
user,the instance will be an empty instance as the fields would not
contain any data. 
like <Summary></Summary> 
So when the form is first time displayed to the user,these alerts come
up while rendering the form as the instance data would not comply with
the constraints set. 
Ideally I want the form to display without any alerts and when the user
enters data and then tabs out to other fields or hits the submit
button,I want the alert messages to be displayed and not while  the form
is getting rendered. 
Would anybody  please let me know how to do that? 


Thanks and Best Regards 
Raghu 
Received on Thursday, 27 November 2003 03:46:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:56 GMT