In good old Oracle Forms you could access an LOV by pressing F9 (depending on your resource file settings). Within APEX you always need a mouseclick....unless you catch a keypress and call the LOV programatically. Of course with help of jQuery.
Create a function in your Page Header:
You can see it live on apex.oracle.com.
Update: After a comment of Louis-Guillaume I changed the above code using the jQuery HotKeys plugin. The code gets a lot simpler:
Create a function in your Page Header:
This function is called by an onkeydown event on the fields with an LOV: onkeydown="checkLOV(this,event)". Ofcourse you also use jQuery and the APEX Repository to set this event for all fields with an LOV definition...
function checkLOV(pThis, pEvent){
var keynum;
var current = document.getElementsByName( pThis.name );
if(window.event) // IE
{ keynum = pEvent.keyCode; }
else if(pEvent.which) // Netscape/Firefox/Opera
{ keynum = pEvent.which; }
if (keynum == 120) //F9
//The LOV function call is in the anchor of the next TD element
{ eval($(pThis).parent().next().children().attr('href'));
}
}
You can see it live on apex.oracle.com.
Update: After a comment of Louis-Guillaume I changed the above code using the jQuery HotKeys plugin. The code gets a lot simpler:
Also available on apex.oracle.com.
$(function(){
$('#P22_EMP').bind('keydown', 'f9', function(){
eval($(this).parent().next().children().attr('href'));
});
$('#P22_DEPT').bind('keydown', 'f9', function(){
eval($(this).parent().next().children().attr('href'));
});
});
Comments
You should take a look at Hotkeys, a jQuery plugin. You can bind a key event on a specific target (think about items/regions).
http://code.google.com/p/js-hotkeys/
Regards,
looks like we are both old Forms users, because I implemented a similar feature in my ApexLib framework to activate LOV and Date Picker popups. In my case it's Alt+Down.
A suggesting for your code, instead of using eval you may want to try jQuery().trigger('click') to fire the regular event handling for the icon.
@Louis: Thanks for the link to this plugin, I'm sure it will be helpful in the future!
Regards
Patrick
I tried hotkeys using
$('#P22_EMP').bind('keydown', 'f9', function(){ eval($(this).parent().next().children().attr('href'));
});
That works, but not only for F8, but for all keys....I guess I'm missing something....
@Patrick
Seems like using trigger('click') only works when there is a onclick event. In this case it is an image within an anchor.