Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
Operating System: Windows XP
Platform: PC
-
32476
Description
PROBLEM:
I am working on a web-app that has "flip-book" navigation, where multiple
fieldsets within a large form are shown/hidden determined by the tab selected.
JavaScript manages the navigation.
When our form is submitted, the client-side JavaScript bombs when it tries to
set focus to the first invalid field (missing required, not an integer, etc.)
which is also CSS hidden. JavaScript cannot set focus on a field that is hidden.
Internet Explorer generates this message: "Cannot move focus to the control
because it is invisible, not enabled, or of a type that does not accept the focus."
This is the offending code in all the validateXXX JS methods:
if (fields.length > 0)
{ focusField.focus(); alert(fields.join('\n')); }POSSIBLE RESOLUTION:
Only set focus if "focusField.style.visibility" is not "hidden" – since CSS can
be used to hide elements.
I tested using Commons Validator 1.1.3 with Struts 1.2.4