W3C home > Mailing lists > Public > www-forms@w3.org > August 2002

RE: Managing Validation Error Messages

From: Micah Dubinko <MDubinko@cardiff.com>
Date: Fri, 2 Aug 2002 15:04:45 -0700
Message-ID: <E840F0B7E6189547BDB91DA8BF2228AB28C66C@csmail.cardiff.com>
To: "'Tomayko, Ryan'" <Ryan_Tomayko@stercomm.com>, www-forms@w3.org
Cc: "'Dan Dennedy'" <DDennedy@digitalbang.com>

Hi Ryan,

>	<xf:bind ref="foo/bar" isValid="rule1"/>
>	<xf:bind ref="foo/bar" isValid="rule2"/>

Actually, by the latest rules this wouldn't be allowed, and would cause an
exception when the XForms Processor tried to put a 2nd 'isValid' model item
prop on the same node.

Your point still stands, however, since there could be two (or more)
different kinds of validations per node. (Note too the new name
isValid->constraint) Such as:

	<xf:bind ref="foo/bar" constraint="rule1" type="my:telplusareacode"
required="rule2"/>

We had talked about something like:
 <alert for="required">Please enter a value here</alert>
 <alert for="constraint">Please enter a phone number in the (nnn) nnn-nnnn
format</alert>
 ...
But there's lots of nasty details in getting that to work as expected and we
never reached consensus on anything beyond a single all-encompassing
message.

.micah


-----Original Message-----
From: Tomayko, Ryan [mailto:Ryan_Tomayko@stercomm.com]
Sent: Friday, August 02, 2002 7:42 AM
To: www-forms@w3.org
Cc: 'Dan Dennedy'
Subject: RE: Managing Validation Error Messages




<<
Error messages per validation rule can be provided with the XML Schema
appinfo element, which resides in an annotation element. Appinfo is meant
for automatic processing.

In XForms error messages are bound to form controls because a form control
is the unit of presentation. The binding expression of a form control
pertains to only one node in the instance data. So how could something a
user has entered through one control cause multiple rules to be violated?
Wouldn't that indicate an error in the structure of the instance data? If
so, it is a bug in the form. The XForms alert elements are not indented to
provide feedback about bugs.
>>

I think we may be talking around each other. Sorry, I'll start from the
beginning. I jumped into my last message hastily.

You can have multiple bind elements associated with a single node and thus
have multiple isValid (constraint) rules associated with a single node. For
instance.


<xf:model>
	<xf:instance>
		<foo xmlns="">
			<bar/>
		</foo>
	</xf:instance>

	<xf:bind ref="foo/bar" isValid="rule1"/>
	<xf:bind ref="foo/bar" isValid="rule2"/>
</xf:model>


This allows multiple isValid constraints to be placed on a single node in
the instance doc. The processor must assume that if any of the isValid
constraints returns false for a given node, the node is invalid. If, say,
the second isValid constraints returns true when the first returned false,
the node is still invalid. An isValid returning false invalidates the node,
an isValid returning true does not necessarily validate the node unless all
isValid constraints associated with a node return true.

As an example, let's say I wanted to validate that a field met the following
conditions using multiple isValid constraints.

a.) A Valid XXX-XXX-XXXX phone number (e.g. all numerics separated by
dashes).
b.) Has an area code that starts with 555.
c.) Ends with a 7.

Now, for clarity to the user, I would like to display an alert message
consistent with the validation rule that was broken as opposed to displaying
a single message that stated all the rules that may or may not have been
broken. We've seen single alert messages get up over a paragraph which
forces the user to go back and check their input against multiple problems
with the data where maybe only a sentence out of the paragraph is specific
to their input. That is considered unacceptable by some and at the very
least inelegant.

I hope this clears up any miscommunication on my part regarding this topic.

- Ryan




-----Original Message-----
From: Werner Donné [mailto:werner.donne@re.be] 
Sent: Friday, August 02, 2002 8:42 AM
To: Tomayko, Ryan
Cc: 'Dan Dennedy'; www-forms@w3.org
Subject: Re: Managing Validation Error Messages


Tomayko, Ryan wrote:
> I want to chime in on this as well. This is one of the greater 
> shortcomings of the spec IMO. It is a shame that validation rules to 
> validation messages is a many to one relationship. It should be 
> possible to provide a descriptive error message for each validation 
> rule.
> 

Error messages per validation rule can be provided with the XML Schema
appinfo element, which resides in an annotation element. Appinfo is meant
for automatic processing.

In XForms error messages are bound to form controls because a form control
is the unit of presentation. The binding expression of a form control
pertains to only one node in the instance data. So how could something a
user has entered through one control cause multiple rules to be violated?
Wouldn't that indicate an error in the structure of the instance data? If
so, it is a bug in the form. The XForms alert elements are not indented to
provide feedback about bugs.

> I also feel that this might fall into a larger hole of 
> data/presentation debate [1]. Should [in]validation messages really be 
> part of the presentation layer? While the validation messages will at 
> some point be presented to the user, the invalidation occurs at the 
> data/logic level. It seems to make more sense to attach a meaningful 
> description to the validation error when the node is found to be 
> invalid. The control is not really what's invalid, the node the 
> control is bound to is invalid. That statement can end up being a 
> slippery slope however as you might apply the same idea to the hint 
> and help common controls.
> 
> - Ryan Tomayko
> 
> [1] See Post from Plechsmíd Martin [Martin.Plechsmid@merlin.cz] Re: 
> XForms Schema Attached 7/25/2002
> 

My opinion about validation messages is described in
http://lists.w3.org/Archives/Public/www-forms/2002Jul/0037.html

I would like to add to this that the model of a form is part of the
presentation layer. The information it describes is presentation
information. The part of the presentation layer which resides on the server
might have to do transformations on a message before sending it to the
business layer. In most cases this is not needed of course and the merits
for this are XForms'.

Werner.
-- 
Werner Donné  --  Re BVBA
Engelbeekstraat 8
B-3300 Tienen
tel: (+32) 486 425803	e-mail: werner.donne@re.be
Received on Friday, 2 August 2002 18:04:55 GMT

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