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

xform validations problems

From: Raghu Krishnamurthy <raghu.krishnamurthy@oracle.com>
Date: Thu, 27 Nov 2003 11:46:23 +0530
Message-ID: <3FC596B7.354A09B1@oracle.com>
To: www-forms@w3.org
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:22:05 GMT

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