You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by David Wynter <da...@btclick.com> on 2002/05/15 14:10:07 UTC

Basic validation of input.

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.
david@roamware.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Basic validation of input.

Posted by Rajeev Kaul <Ra...@customercaresolutions.com>.
David,

I was just commenting that it cannot be a substitute for the intake service,
which applies to all forms.  Your solution will be confined to form objects
that have corresponding Peer objects.

Rajeev
----- Original Message -----
From: "David Wynter" <da...@btclick.com>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Wednesday, May 15, 2002 11:37 AM
Subject: RE: Basic validation of input.


> Rajeev,
>
> It is only intended for form objects that have peer objects, which is all
of
> my form objects!
>
> David
>
> -----Original Message-----
> From: Rajeev Kaul [mailto:Rajeev@customercaresolutions.com]
> Sent: 15 May 2002 19:34
> To: Turbine Users List
> Subject: Re: Basic validation of input.
>
>
> This approach will only work for form fields that have corresponding
> properties in peer objects.  What will you do in cases where the form
fields
> do not belong to peer objects?
>
> Rajeev
> ----- Original Message -----
> From: "David Wynter" <da...@btclick.com>
> To: "Turbine-User" <tu...@jakarta.apache.org>
> Sent: Wednesday, May 15, 2002 5:10 AM
> Subject: Basic validation of input.
>
>
> > 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.
> > david@roamware.com
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Basic validation of input.

Posted by David Wynter <da...@btclick.com>.
Rajeev,

It is only intended for form objects that have peer objects, which is all of
my form objects!

David

-----Original Message-----
From: Rajeev Kaul [mailto:Rajeev@customercaresolutions.com]
Sent: 15 May 2002 19:34
To: Turbine Users List
Subject: Re: Basic validation of input.


This approach will only work for form fields that have corresponding
properties in peer objects.  What will you do in cases where the form fields
do not belong to peer objects?

Rajeev
----- Original Message -----
From: "David Wynter" <da...@btclick.com>
To: "Turbine-User" <tu...@jakarta.apache.org>
Sent: Wednesday, May 15, 2002 5:10 AM
Subject: Basic validation of input.


> 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.
> david@roamware.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Basic validation of input.

Posted by Rajeev Kaul <Ra...@customercaresolutions.com>.
This approach will only work for form fields that have corresponding
properties in peer objects.  What will you do in cases where the form fields
do not belong to peer objects?

Rajeev
----- Original Message -----
From: "David Wynter" <da...@btclick.com>
To: "Turbine-User" <tu...@jakarta.apache.org>
Sent: Wednesday, May 15, 2002 5:10 AM
Subject: Basic validation of input.


> 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.
> david@roamware.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>