You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <ne...@husted.com> on 2001/02/15 13:24:50 UTC

Re: Client-side validation (Old questions that die hard)

David Winterfeldt wrote:
> I posted the code and a example war at.  Ted, if you
> want to, you can add this to the list of struts
> sites/resources you have.  

I've added this to my list at < http://husted.com/about/struts >, along
with Craig T's very kewl presentation.

If this keeps up, we're going to need an announcement list just to keep
up with the new Struts resources!

I'm hip deep (down from neck deep) in the Dreamweaver UltraDev tutorials
right now, but as soon that's done, I'm back to refining validation
for my working application -- which would now mean taking your Validator
for a spin!

What I really like about this at first glance is the XML configuration.
This plays well into integrating this both with Struts and with visual
environments, like UltraDev. 

Have you thought about offering built-in expressions for standard Java 
and SQL types?

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/about/struts/

RE: Client-side validation (Old questions that die hard)

Posted by Neal Kaiser <ne...@makeastore.com>.
Dave,

One functionality that might be nice for the validation you are working on:

The ability to say that a field is required IF a certain form parameter
exists.

Something like:

<logic:equal name="registrationForm" property="role"
                  scope="request" value="Admin">

 <field    property="addr"
      		displayname="registrationForm.addr.displayname"
      		required="true"/>

</logic:equal>

So, the property "addr" is validated ONLY if the
registrationForm.role="Admin"

That's probably not the best syntax, but I think you get what I mean.

Thanks, Neal


> -----Original Message-----
> From: David Winterfeldt [mailto:dwinterfeldt@yahoo.com]
> Sent: Thursday, February 15, 2001 12:06 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: Client-side validation (Old questions that die hard)
>
>
> I actually had some built-in expressions for testing,
> but then I pulled it out for simplicity.  I had some
> basic things like phone numbers and such hard coded in
> and checking for a date (leap year, etc.), but I
> thought it might be better to wait and think about it
> a little more so someone could plug in their own date
> validation function if they wanted to.
>
> Although I assume you're talking about primitives,
> String, and Date which would cover a lot forms.  I
> hadn't really thought about that, but it is a good
> idea.  I could add a type attribute to the field
> element (ex: type="int").  I was hoping that before I
> did too much more on it that if it looked like a good
> start it could be used and/or modified for the struts
> validation in 1.1.  I would be interested in being
> involved in working on the validation framework.  So I
> thought it would be a good idea to hear about ideas
> and what the validation framework should do before I
> did more work.  As the validation starts expanding, it
> may be a lot of work to keep the client side
> javascript in sync with it.  Although if everything is
> kept clean enough that you call a method to do
> something there could be an equivalent Javascript
> method (as long as it doesn't hit a database or server
> side resource).
>
> It would also be nice to have basic expressions like
> this value should be an int and when that is confirmed
> be able to check if it is in a range.
>
> Ted, do you have an opinion on how locale should be
> handled if validation rules are kept in an xml file?
> Should there be a separate file for each locale like
> resource files or an attribute in the xml file.  I
> could make a 'form set' element and it could have a
> locale attribute.  You could then group forms in a
> locale and even set one group as a default.  I was
> also thinking about making validation resource class
> like MessageResource and putting that in application
> scope instead of a Hashtable.  To keep the validation
> in line with struts, it would be important to be able
> to specify different validation rules for different
> countries.
>
>
> David
>
> --- Ted Husted <ne...@husted.com> wrote:
> > David Winterfeldt wrote:
> > > I posted the code and a example war at.  Ted, if
> > you
> > > want to, you can add this to the list of struts
> > > sites/resources you have.
> >
> > I've added this to my list at <
> > http://husted.com/about/struts >, along
> > with Craig T's very kewl presentation.
> >
> > If this keeps up, we're going to need an
> > announcement list just to keep
> > up with the new Struts resources!
> >
> > I'm hip deep (down from neck deep) in the
> > Dreamweaver UltraDev tutorials
> > right now, but as soon that's done, I'm back to
> > refining validation
> > for my working application -- which would now mean
> > taking your Validator
> > for a spin!
> >
> > What I really like about this at first glance is the
> > XML configuration.
> > This plays well into integrating this both with
> > Struts and with visual
> > environments, like UltraDev.
> >
> > Have you thought about offering built-in expressions
> > for standard Java
> > and SQL types?
> >
> > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > -- Custom Software ~ Technical Services.
> > -- Tel 716 425-0252; Fax 716 223-2506.
> > -- http://www.husted.com/about/struts/
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/
>


Re: Client-side validation (Old questions that die hard)

Posted by David Winterfeldt <dw...@yahoo.com>.
I actually had some built-in expressions for testing,
but then I pulled it out for simplicity.  I had some
basic things like phone numbers and such hard coded in
and checking for a date (leap year, etc.), but I
thought it might be better to wait and think about it
a little more so someone could plug in their own date
validation function if they wanted to.  

Although I assume you're talking about primitives,
String, and Date which would cover a lot forms.  I
hadn't really thought about that, but it is a good
idea.  I could add a type attribute to the field
element (ex: type="int").  I was hoping that before I
did too much more on it that if it looked like a good
start it could be used and/or modified for the struts
validation in 1.1.  I would be interested in being
involved in working on the validation framework.  So I
thought it would be a good idea to hear about ideas
and what the validation framework should do before I
did more work.  As the validation starts expanding, it
may be a lot of work to keep the client side
javascript in sync with it.  Although if everything is
kept clean enough that you call a method to do
something there could be an equivalent Javascript
method (as long as it doesn't hit a database or server
side resource).  

It would also be nice to have basic expressions like
this value should be an int and when that is confirmed
be able to check if it is in a range.

Ted, do you have an opinion on how locale should be
handled if validation rules are kept in an xml file? 
Should there be a separate file for each locale like
resource files or an attribute in the xml file.  I
could make a 'form set' element and it could have a
locale attribute.  You could then group forms in a
locale and even set one group as a default.  I was
also thinking about making validation resource class
like MessageResource and putting that in application
scope instead of a Hashtable.  To keep the validation
in line with struts, it would be important to be able
to specify different validation rules for different
countries.


David

--- Ted Husted <ne...@husted.com> wrote:
> David Winterfeldt wrote:
> > I posted the code and a example war at.  Ted, if
> you
> > want to, you can add this to the list of struts
> > sites/resources you have.  
> 
> I've added this to my list at <
> http://husted.com/about/struts >, along
> with Craig T's very kewl presentation.
> 
> If this keeps up, we're going to need an
> announcement list just to keep
> up with the new Struts resources!
> 
> I'm hip deep (down from neck deep) in the
> Dreamweaver UltraDev tutorials
> right now, but as soon that's done, I'm back to
> refining validation
> for my working application -- which would now mean
> taking your Validator
> for a spin!
> 
> What I really like about this at first glance is the
> XML configuration.
> This plays well into integrating this both with
> Struts and with visual
> environments, like UltraDev. 
> 
> Have you thought about offering built-in expressions
> for standard Java 
> and SQL types?
> 
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel 716 425-0252; Fax 716 223-2506.
> -- http://www.husted.com/about/struts/


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/