You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "David Stuart (JIRA)" <ji...@apache.org> on 2009/10/13 02:02:50 UTC

[jira] Created: (WW-3283) client side validation for css_xhtml fails when using required="true"

client side validation for css_xhtml fails when using required="true"
---------------------------------------------------------------------

                 Key: WW-3283
                 URL: https://issues.apache.org/struts/browse/WW-3283
             Project: Struts 2
          Issue Type: Bug
          Components: XML Validators
            Reporter: David Stuart


Within the validation.js file for the css_xhtml theme the function findWWCtrlNode(enclosingDiv ) uses the code....

for(var elem in enclosingDiv.getElementsByTagName("div")) { 

to find either div's or later span's. This code only returns undefined responses and therefore always returns the final line of code within the function...

return enclosingDiv.getElementsByTagName("span")[0];

This returns null if the user hasn't set required="true" within the taglib but will return the span used for showing * in red as a required field otherwise. This means that the new inserting error div generates a javascript error....

Possible solutions...

1. Change the loop to actually find the classes it is searching for

var e=enclosingDiv.getElementsByTagName("div");
	 for(var i=0;i<e.length;i++) {
		 if (e[i].className && e[i].className.match(/(wwlbl|wwctrl)/))
	          return e[i];
	 }

2. add a span into the generated css code so that when the final line of code searches for the first one it find one that it can inssert the error code into
3. return nll if no div's or spans are found

Cheers
Dave




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.