[ https://issues.apache.org/struts/browse/STR-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Benedict resolved STR-1496. -------------------------------- Resolution: Fixed > html:form focus and focusIndex problem > -------------------------------------- > > Key: STR-1496 > URL: https://issues.apache.org/struts/browse/STR-1496 > Project: Struts 1 > Issue Type: Improvement > Components: Taglibs > Affects Versions: 1.1 RC1 > Environment: Operating System: All > Platform: All > Reporter: Tyler Van Gorder > Assignee: Paul Benedict > Priority: Minor > Fix For: 1.3.10 > > > The javascript generated when using focus and focusIndex does not account for > the > following prolblem: > We have a radio button group that is dynamically created based on a database > query. There may be 1 or more items in the group. In the case where a single > item exists, the radio button does NOT have any sub-elements, so in that case > we > need to use *JUST* the focus attribute of the form tag. However, if the radio > button has more than one element we need to use both the focus and the > focusIndex attributes. It would be highly desirable to be able to always > specify > the focus attribute to the name of the radio button and if the focusIndex is > NOT > specified but sub-elements do exist, the focus is set to the "0" element for > the > control. > EX: > My form is "referralsToPvdReport" > The field "selectedIndices" is a checkbox group (checkboxes with the same > name) > The checkboxes are created by iterating over a collection of database records > and therefore the index will conditionally be present if more than one record > needs to be rendered. > var focusControl = > document.forms["referralsToPvdReport"].elements["selectedIndices"]; > if (focusControl.type != "hidden") { > if (focusControl[0]) { > focusControl[0].focus(); > } else { > focusControl.focus(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.