You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2009/10/23 17:20:51 UTC
[jira] Updated: (WW-3295) Display of Ajax-Validation-Errors may
fail on Internet Explorer
[ https://issues.apache.org/struts/browse/WW-3295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Musachy Barroso updated WW-3295:
--------------------------------
Fix Version/s: 2.2.0
> Display of Ajax-Validation-Errors may fail on Internet Explorer
> ---------------------------------------------------------------
>
> Key: WW-3295
> URL: https://issues.apache.org/struts/browse/WW-3295
> Project: Struts 2
> Issue Type: Bug
> Components: Other
> Affects Versions: 2.1.6
> Reporter: Wolfgang Schröder
> Fix For: 2.2.0
>
>
> I'm using prototype.js together with the ajax-validation-interceptor and the "built-in" StrutsUtils-JavaScript. The validation itself works perfect for both, Firefox and IE. When it comes to displaying the errormessages per field, I'm using the "built-in" JavaScript-Utilities /struts/utils.js and /struts/css_xhtml/validation.js
> When the ajax-validation returns I'm calling StrutsUtils.showValidationErrors(form, errorsObject); which fails on IE with a JavaScript-Alert (one per validation/fielderror) showing "An exception occurred: Error. Error message: Illegal argument but not on Firefox.
> I drilled into the problem and found, that the variable 'firstCtrNode' is undefined (in both, IE and Firefox). This causes a problem in the call 'enclosingDiv.insertBefore(errorDiv, firstCtrNode);'
> IE and Firefox are showing different behaviour. Firefox always insists on a two arg call, even if the second arg is null. IE throws an exception when the second arg is null and only accepts a call with one arg.
> Code from /struts/css_xhtml/validation.js, from Line 94 on:
> var firstCtrNode = findWWCtrlNode(enclosingDiv); // either wwctrl_ or wwlbl_
>
> var error = document.createTextNode(errorText);
> var errorDiv = document.createElement("div");
> errorDiv.setAttribute("class", "errorMessage");//standard way.. works for ie mozilla
> errorDiv.setAttribute("className", "errorMessage");//ie hack cause ie does not support setAttribute
> errorDiv.setAttribute("errorFor", elem.id);
> errorDiv.appendChild(error);
> enclosingDiv.insertBefore(errorDiv, firstCtrNode); // <---- This line fails on IE
> My bugfix/workaround is:
> if(!firstCtrNode && navigator.appName == 'Microsoft Internet Explorer')
> enclosingDiv.insertBefore(errorDiv);
> else
> enclosingDiv.insertBefore(errorDiv, firstCtrNode);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.