I added basic client side javascript validation that
matches the server side validation.  Validation rules
are stored in an xml file.  

I thought that if the form had a locale attribute that
would take care of i18n or there could be separate
files like the property resource files.

I was also thinking about how open the validation
framework should be.  If it could be configured a
little like some Ant tasks, you could define a method
to perform validation and what validation need to
finish before others proceed like the Ant depends
attribute.
   <name="required"
    class="org.apache.struts.Validation"
    property="validateRequired"/>

   <name="regexp"
    class="org.apache.struts.Validation"
    property="validateRegexp"
    depends="required"/>

   <field property="firstName" 
          validations="required,regexp" 
          mask="^\w+$" /> 

I thought of this because I'm checking for all
required fields before continuing to check the regular
expressions.  Anyway, it's late.  I hope that part
made sense.

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.  Is this something along the
lines you were thinking of?  Let me know what you
think of Ted.
http://home.earthlink.net/~dwinterfeldt

David Winterfeldt

--- Ted Husted <[EMAIL PROTECTED]> wrote:
> My initial thoughts were to look at what some of the
> advanced HTML
> authoring tools, like FrontPage and Dreamweaver do
> with this. Craig
> mentioned to me that the client-side validations
> should be coordinated
> with any new work on server-side validations. 
> 
> Obviously, some standard "domain type" validations
> would be very useful,
> corresponding to Java or SQL types. These might be
> the sorts of things
> we could easily add as properties, and would fit in
> with any IDE
> integration projects.
> 
> These could then be braced server-side with hardcore
> regex validations,
> along with any business logic checking.
> 
> Of course, late-model Javascript also supports regex
> ...
> 
> Jim Richards wrote:
> >>The other thing I haven't found reference to yet
> is
> >>client side validation (but I also haven't looked
> that hard either)
> 
> > I did notice that you had your name down for the
> client
> > side validation. I'd be interested in your
> thoughts, and
> > ideas because this is something I've done a lot of
> > recently (not in Struts/JSP though) ...
> 
> -- 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/

Reply via email to