struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Bathje" <>
Subject Re: 2 unanswered questions
Date Mon, 02 Feb 2004 16:37:24 GMT
Replying to myself here - but after some searching over the weekend, I found
bug 17667 - which is the same problem I have been having. Stupid me
searching for "multiple form" all this time instead of "multi-form" never
found it.

Anyways, I took the patches that had been attached to that bug already, and
updated them for the latest versions of Struts and Commons Validator (mostly
moving all the javascript fixes out of validator-rules.xml and into the
individual .js files in validator) and it is working great. Much cleaner
then the crap I had been brewing up as well.

I put the new patches back up under the bug if anybody else is interested.
(Or if they want to put this in 1.2)

Matt Bathje

----- Original Message ----- 
From: "Matt Bathje" <>
To: "Struts Users Mailing List" <>
Sent: Thursday, January 29, 2004 6:00 PM
Subject: Re: 2 unanswered questions

> > I'm assuming that you've at least specified distinct values for the
> > "method" attribute for each use of <html:javascript>?
> >
> > (Actually, looking at the doc I see that the process when this isn't
> > specified should result in unique validate method names.)  I've never
> > actually tried to validate multiple forms in a single page.  You may
> > have simply discovered a limitation in the design of the validator
> > stuff.  If so, feel free to submit an enhancement request in
> > Bugzilla, and feel just as free (or more so) to attach patches to
> > help solve the problem!
> Yes, specifying the method doesn't help with the problem.
> I started working on a patch - and it doesn't seem like it is going to be
> struts specific. The validator javascript files (as well as the validator
> itself maybe) need to be changed so that this can be done.
> Basically what I have started on doing is:
> 1. adding a multipleForm (true|false) property to the html:javascript
tag -
> if it is true it means we want multiple js validators on the same page.
> 2. Modifying
> to append the formName to the javascript functions that it outputs in the
> ValidatorAction iteration loop. (If multipleForm = true)
> 3. Modifying
> ods to alter the validator javascript if multipleForm = true. The 2 things
> am trying to have it do are replace the function definition with a
> definition that includes the form name and replace the oRequired (or
> whatever) array definition call with a call that includes the form name
> oRequired = new required(); becomes oRequired = new requiredFormName();)
> 1 and 2 are no problems.
> 3 on the other hand is a major pain in the butt, and where alterations to
> validator instead of struts come in.
> First, the .js files follow very loose standards for naming. Weird things
> like oRequired for the required validator, but oMasked for the mask
> validator. Weird things like minlength and maxlength both having wacky
> upper/lower case changes all over. This makes doing String.replaceall()
> operations on the .js files extremely tricky. The .js files would need to
> changed to make sure they follow a standard that could be parsed properly.
> The second problem is that I don't even think these replace operations
> belong in struts, but in the validator code itself. (Like in
> org.apache.commons.validator.ValidatorAction.loadJavascriptFunction
> possibly) The problem here is I'm not entirely sure how to get the
> html:javascript multipleForm variable into ValidatorAction properly. I am
> also not sure if this is even the best/most elegant solution. If having it
> in the validator code is good, is loadJavascriptFunction the best place
> it, or is somewhere else better? Does that code actually belong in struts
> validator?
> I can hack some stuff together and use it on our own sites, but I'd really
> like to be able to contribute this stuff back so I want to make it
> Thats all for now, let me know what you all think.
> Thanks,
> Matt Bathje
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message