How to use a key press to submit

liunx

Guest
On my Logon screen if someone presses return i want that to act like the button to submit details.

i'm sure it can be done

any help very welcome

thanks

frankare you trying to do this without the "submit" button showing?No the submit button is showing.

currently you must click it or tab through username, password, then submit and hit return.

is there any way that i can do it so it checks when return is pressed on password field.

although in the process of writing this i have had a moment of clarity on how i can do it d'ohI use the below javascript and onkeypress event to catch the return key press on textboxes and force submitting on a particular button.


onkeypress="fnTrapKD('btnSearch',event);"



function getObject(obj){if(document.getElementById){return document.getElementById(obj);}else{if(document.all){return document.all[obj];}}}
function fnTrapKD(btn, event){
var btn = getObject(btn);
if (document.all){if (event.keyCode == 13){event.returnValue=false;event.cancel = true;btn.click();}}
else{if (event.which == 13){event.returnValue=false;event.cancelBubble = true;btn.click();}}
}
 
Back
Top