RE: xform validations problems

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 UTC