[ https://issues.apache.org/jira/browse/VALIDATOR-259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb resolved VALIDATOR-259. ---------------------------- Resolution: Won't Fix Javascript routines are no longer maintained and have been deprecated > [validator] Javascript jcv_handleErrors function fails in IE when field's > ancestor is not visible > ------------------------------------------------------------------------------------------------- > > Key: VALIDATOR-259 > URL: https://issues.apache.org/jira/browse/VALIDATOR-259 > Project: Commons Validator > Issue Type: Bug > Components: JavaScript > Affects Versions: 1.3.1 Release > Environment: Win XP, Sun JVM 1.4.2_x > Tomcat 4.1.x, Struts 1.3.8 > Reporter: Vasily Ivanov > Attachments: VALIDATOR-259.patch > > > If field is in hidden div (for example) than Javascript validation fails in > IE with the following error: > "Error: Can't move focus to the control because it is invisible, not enabled, > or of a type that does not accept focus." > jcv_handleErrors(messages, focusField) needs to be modified to traverse all > parent nodes and check their visibility: > function jcv_handleErrors(messages, focusField) { > if (jcv_canFocus(focusField)) { > focusField.focus(); > } > > alert(messages.join('\n')); > } > function jcv_canFocus(field) { > var result = true; > > if (field && field != null && typeof(field) != 'undefined') { > if (field.disabled || field.type == 'hidden') { > result = false; > } > if (result && > field.style && > field.style.visibility && > field.style.visibility == 'hidden') { > result = false; > } > if (result) { > var parent = field.parentNode; > if (parent && parent != null && typeof(parent) != 'undefined' && > parent.nodeType == 1) { > result = jcv_canFocus(parent); > } > } > } else { > result = false; > } > > return result; > } > WORKAROUND: > 1. Copy validateUtilities.js file from > commons-validator-1.3.1.jar!\org\apache\commons\validator\javascript\validateUtilities.js > into classpath under your control and apply patch above. > 2. Modify validator-rules.xml: > <validator name="includeJavaScriptUtilities" classname="" method="" > methodParams="" depends="" msg="" > jsFunction="com.company.path.to.jsfile.validateUtilities" /> -- This message was sent by Atlassian JIRA (v6.3.4#6332)