Hi,

I had intended to use Intake as my validation method for the dozen screens
in my application. But looking at it there is a fair amount of work to
implement it. Considering that I just want to cover the following validation
it seems overkill.
For each attribute entered check the following:

Is there a value entered for not null fields?
Is the value trimmed?
Does the String value entered convert to the data type for the column?
Is the value longer than allowed by the column?
Is there a value entered for a required foreign key?

So I don't need the Regex mask capability provided by Intake and all of the
information for the above (except the trim) is available in the ColumnMap
for each attribute. I could use the ***Peer class for each object to
retrieve the MapBuilder, then use this to get the DatabaseMap then use this
to getTable to get the TableMap and finally use this to get the ColumnMap[].

e.g. ColumnMap[] colMaps =
RwStreamPeer.getMapBuilder().getDatabaseMap().getTable(RwStreamPeer.TABLE_NA
ME).getColumns();

Then a single function in a service like, .basicValidate(ColumnMap[]
colMaps, ParameterParser parser) could validate regardless of the object you
are validating.

Then use the ColumnMap to match by lowercase names of the parameters to the
column names and you can carry out the tests.

For returning the error messages load up a HashMap with any error messages
keyed on the name of the input field e.g. $name in
#if ($errormsgstool.getValue($name)!= null)
        <p> $errormsgstool.getValue($name) </p>
#end
<input type="text" size="30" name="$name" value="$value">

Since this is generic the message cannot be specific to the entry field so
proximity to the input field is required to get across the context of the
error message.

I haven't pursued this yet. Has anyone done something similar or have any
comments on the approach?

Thanks,


David Wynter
roamware Ltd.
(+44) (0) 208 922 7539 B.
(+44) (0) 7879 605 706 M.
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to