I have a form that uses AjaxAnywhere that is losing the focus to the next input tag following an ajaxAnywhere.submitAJAX();
call. This only occurs in IE, Mozilla works fine.
I maintain the form input tag where focus should go to within a form variable which is hidden in the form and conditionally set in the servlet.
In the jsp, I call a javascript function:
function setFocus(focusIn) {
// alert(focusIn);
eval('document.myForm.'+fo
cusIn+'.fo
cus();');
}
This function is called within an Ajax refresh zone as follows:
<aa:zone name="inputFocus2">
inputFocus: <bean:write name="myForm" property="inputFocus"/> <-- debugging
<%
String newFocus = myForm.getInputFocus();
if((newFocus == null) ||
(newFocus.length() == 0))
{
newFocus = "ptNumber";
}
%>
<script language="Javascript">
<!--
setFocus('<%= newFocus %>');
// -->
</script>
</aa:zone>
What is strange, that if I have the 'alert', this will work in IE. This behavior is very odd, does anyone know what I am not doing correctly to have IE 7 not work properly?
Start Free Trial