Field Validation Issue

10 views
Skip to first unread message

Daren

unread,
Aug 19, 2010, 11:49:19 AM8/19/10
to jmatter
I have encountered an issue with the way field validation errors are
displayed. Using the ContactMgr application that is distributed with
the JMatter source: When I enter an invalid value (aaa instead of
a...@bbb.com) in the email field of a new 'business' object and then
leave the field via hitting <tab>, it correctly displays an error
("Invalid email address syntax: aaa "). However, if I then type
another character in the field and hit tab to leave the field, the
validation error disappears even though the value is still invalid.
The field validation error is not displayed until I hit <return>
(validated on save?).

It seems like validation errors only get displayed if the previous
value was empty or valid. If I enter a well-formed value for the
email field, hit <tab> and successfully move to the next field, I can
then go back, enter a bad value and get the error message. But after
that, it's the same behavior I originally described. Validation errors
aren't displayed when leaving the field if the value was invalid
before the edits were made.

This seems to only happen with Complex data types. For an Int value,
if I enter an illegal value (such as an alpha character), it will
repeatedly display the validation error.

Ultimately, the incorrectly entered values will get caught by the
validation on 'Save', but this is less than ideal for a user that has
entered numerous incorrect values.

Any suggestions on how to work around this?

eitan

unread,
Aug 23, 2010, 10:29:13 PM8/23/10
to jmatter
Hi Daren,
Sorry for the late reply. My suggestion is to go ahead
and fix this in jmatter. it should be rather simple to step
through the code and see how the validation logic works
and where it errors, and then to fix it.

you know how you can create a project either in standalone
or dependent mode? in dependent mode, the build file for your
project will automatically depend on the jmatter project and any
changes to the jmatter code base will be recompiled when you
rebuild your project.

the starting point for validation is the base class for domain
objects: look at AbstactComplexEObject.validate(). it calls
type().validate(), which then iterates over the fields and calls
validate() on each field.

anyhow, i hope this helps.

thanks,
/ eitan
Reply all
Reply to author
Forward
0 new messages