APEX-AT-WORK no image

Focus problem with IE6 and APEX_ITEM.SELECT_LIST_FROM_LOV

Von Tobias Arnhold 2.12.2009
If you are using the SELECT_LIST_FROM_LOV item in your apex reports you may have noticed that you can get some trouble with the Internet Explorer 6.

For example your report includes 100 rows which are all displayed on one page and you must scroll up and down to reach all items. In case you have the focus on one of your select list items and set it from value x to y and immediately after that you want to scroll down. The cursor stays in the item and scrolls inside instead of outside the page.

This behavior just appears with IE6 all newer browser works after a standard behavior. After you selected an item value and you start scrolling, the page scrolls after your mouse movement.

How to fix this issue with IE6? You need to edit your SQL select statement for your report:

-- select statement with IE6 problems
select
b_id as "Book number",
'<b>'||b_name||'</b>' ||
' (' || b_description || ') ' as "Book name"
apex_item.SELECT_LIST_FROM_LOV(
1, -- p_idx
b_category_id, -- p_value
'LOV_BOOK_CATEGORIES', -- p_lov
'', -- p_attributes
'YES', -- p_show_null
'', -- p_null_value
'no book category selected', -- p_null_text
'', -- p_item_id
'' -- p_item_label)
as "Book category"
from books;

-- fixed select statement with attribute for wrong focus behavior
select
b_id as "Book number",
'<b>'||b_name||'</b>' ||
' (' || b_description || ') ' as "Book name"
apex_item.SELECT_LIST_FROM_LOV(
1, -- p_idx
b_category_id, -- p_value
'LOV_BOOK_CATEGORIES', -- p_lov
'onChange="body.focus()"', -- p_attributes
'YES', -- p_show_null
'', -- p_null_value
'no book category selected', -- p_null_text
'', -- p_item_id
'' -- p_item_label)
as "Book category"
from books;

You need to use onChange="body.focus()" in the attribute section.

Of course you can also use this functionality in a normal select list item.
Go Edit Page Item>Element>HTML Form Element Attributes
and add: onChange="body.focus()"