Skip to Content
0
Former Member
Sep 07, 2005 at 03:50 PM

JavaScript error "Can't move focus to the control because it is invisible..

62 Views

I am getting a JavaScript error on an MVC BSP application after we upgraded to WebAS 6.40, which I was not getting on 6.20.

I have a dropdownlistbox on my BSP page (it is actually a View since I am using MVC). When the user makes a change to this dropdownlistbox selection, it triggers a JavaScript which opens a new browser window (using window.open) for a Page with Flow Logic (which is in the same BSP application). The user must enter some information into that new browser window and then push a button. When that button is pushed, I need to close the new browser window and trigger something on my original BSP page so that it will go back to SAP and trigger the DO_HANDLE_EVENT method.

When I originally coded this, I read several posts in the SDN forums, such as this one:

set-htmlbbutton-to-invisible

This was my solution... I included an htmlb:button on my original BSP page, but I put it within <div></div> tags which assigned a style to the button so that it was not displayed on the screen. This worked exactly the way that I wanted it to. Within the 2nd browser window, I used:

window.opener.document.getElementById("buttonname").click();

This caused the hidden button to be clicked, which then sent the htmlb event back to DO_HANDLE_EVENT. All was well with the world.

Then we upgraded the WebAS from 6.20 to 6.40, and suddenly I started getting this JavaScript error whenever the JavaScript command tried to execute the click(); for the hidden button. The error message is:

"Error: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."

Here's the kicker - even if I remove the <div></div> tags so that the button is visible on the screen, I still get the same JavaScript error message! So this doesn't seem to be limited to the fact that I had tried to hide the button on the page.

I followed the other suggestion in the forum, which was to use an htmlb:image tag instead and make the height and width = "0", but I get the same error message.

Nothing has changed (that I can think of) from the time that this worked to the time that I started getting the JavaScript error, except for the WebAS upgrade. My browser version is the same, etc.

I would greatly appreciate any advice that you can give me regarding this JavaScript error message!

- Shannon