field validation

D

Don Dwoske

Looking for a way to do field validation based on consise rules.

I have a page representing a 'Panel' (a collection) of 'Measurements' of
biological samples.

Each Measurement has a MeasurementType. MeasurementType has a
validation rule.. some MeasurementTypes are strings, some are integers,
some are floats. For numbers, range checking may be involved.

I want to add the validation rule to the meta-data for the
MeasurementType. all validation is done server-side. Each entered
value would be validated against the proper MeasurementType.validationRule.

Does anyone know of any tools such that I can define, in a very concise
way what the validation rules for a particular string value is?

I have thought of the following:

1. regular expressions - I could define regex's which validate strings,
floats, ints, etc.. but I don't really know how to do range checking,
and regex are hard for common folks to understand.

2. package such as commons-validator - rules are defined in xml file and
the rules are verbose. i need terse.

3. define an xsd type and use an xsd checker ?


Optimally, I would be able to have a column in the database and have the
rule in it.

A good looking rule might be:

required & string # required and string
required & integer(-50,50) # integer between -50 and 50
optional & string('MA','CT','NY','NH') # string falling in this set
required & ( string | integer ) # required string or integer value

I could certainly write such a thing, but there must be something I can
reuse... does anyone know of such a validation package with simple rules
like these ?

Cheers,
Don
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top