You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Christian Resch <c....@gmx.de> on 2010/01/20 10:42:33 UTC

Javascript Validation-Error in css_xhtml template

There occurs a javascript error in IE8 ("An exception occurred") when using validation=true on struts form tag and having an validation error in the browser. In Firefox there's no problem. Other browsers not tested. Using Struts version 2.1.8.1.
The reason is in the function 'findWWCtrlNode' in validation.js

The line "for(var elem in enclosingDiv.getElementsByTagName("div"))" doesn't work correctly.
Replacing this line with something like

var elems = enclosingDiv.getElementsByTagName("div");
for(var i = 0; i < elems.length; i++) {
    var elem = elems[i];
    ...
}

fixes the problem.
Same for the "for(var elem in enclosingDiv.getElementsByTagName("span"))" loop in the same function.

-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Javascript Validation-Error in css_xhtml template

Posted by Wes Wannemacher <we...@wantii.com>.
Can you file a JIRA issue and provide a patch? That would make it
easier to incorporate the change into the next release of struts 2.

-Wes

On Wed, Jan 20, 2010 at 4:42 AM, Christian Resch <c....@gmx.de> wrote:
> There occurs a javascript error in IE8 ("An exception occurred") when using validation=true on struts form tag and having an validation error in the browser. In Firefox there's no problem. Other browsers not tested. Using Struts version 2.1.8.1.
> The reason is in the function 'findWWCtrlNode' in validation.js
>
> The line "for(var elem in enclosingDiv.getElementsByTagName("div"))" doesn't work correctly.
> Replacing this line with something like
>
> var elems = enclosingDiv.getElementsByTagName("div");
> for(var i = 0; i < elems.length; i++) {
>    var elem = elems[i];
>    ...
> }
>
> fixes the problem.
> Same for the "for(var elem in enclosingDiv.getElementsByTagName("span"))" loop in the same function.
>
> --
> Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
> sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org