Advertisement

04.21.2008 at 10:13AM PDT, ID: 23340262
[x]
Attachment Details

Javascript/Ajax input focus lost under IE

Asked by djpriceAtl in JavaScript, Java Server Pages (JSP), Java Standard Tag Library (JSTL) & Server Tags

Tags: Javascript and Ajax, IE 7.0

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.'+focusIn+'.focus();');
          }
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
 
Loading Advertisement...
 
[+][-]04.21.2008 at 11:40PM PDT, ID: 21408532

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 03:31AM PDT, ID: 21409522

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 04:53AM PDT, ID: 21409990

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:15AM PDT, ID: 21410758

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 09:52AM PDT, ID: 21422794

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 06:27PM PDT, ID: 21426972

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 03:32AM PDT, ID: 21429294

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Java Server Pages (JSP), Java Standard Tag Library (JSTL) & Server Tags
Tags: Javascript and Ajax, IE 7.0
Sign Up Now!
Solution Provided By: djpriceAtl
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.24.2008 at 04:45AM PDT, ID: 21429713

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628