You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/05/13 19:24:13 UTC
DO NOT REPLY [Bug 28958] New: -
Multiple forms on same JSP using DynaValidator fail
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28958>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28958
Multiple forms on same JSP using DynaValidator fail
Summary: Multiple forms on same JSP using DynaValidator fail
Product: Struts
Version: 1.1 Final
Platform: PC
OS/Version: Windows NT/2K
Status: UNCONFIRMED
Severity: Enhancement
Priority: Other
Component: Validator Framework
AssignedTo: dev@struts.apache.org
ReportedBy: lowtherk@insession.com
When including two forms on the same JSP, each using the DynaValidator, the
validation will ALWAYS fail for the first form when both forms use the same
types of validations as defined in the validator-rules.xml when using
dynamicJavascript="true" for each form.
The reason for this is that the DynaValidator generates the same name when
using for the Javascript function no matter which form is being used. For
example, any required fields for form "abc" will generate a Javascript function
called required() for the page. Similarly, form "xyz" will also generate a
function called required() for the page. Both forms will utilize the latter
definition, resulting in a Javascript error for the former form with the
following text: 'type' is null or not an object. This is because the field
referenced in the required() function that was called does not exist in the
form.
The obvious workaround is to make these form objects in Java and define the
validation there. The more permanent solution for the DynaValidator would be
to have it generate the functions using the form name as part of the function
name, such as "abcRequired" and "xyzRequired". This would remove any possible
naming collisions associated with the DynaValidator Javascript generation. One
could also just collapse all of the required/maxlength/etc. functions under the
validateXXXForm and forget about splitting them out, but this is less
desirable, IMHO.
Using staticJavascript="true" by itself isn't an option, since the
validateXXXForm isn't generated, making the DynaValidator useless in this
situation.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org