AjithTV Posted December 23, 2008 Share Posted December 23, 2008 Hi everyone , I would really appreciate if anyone knows the code for enabling 'Enter' button for submitting a login form . Right now I am using <a> tag with onclick='myform.submit()' to submit the form.Please help.Thanks. Link to comment https://forums.phpfreaks.com/topic/138206-enabling-enter-button-on-submitting-a-form/ Share on other sites More sharing options...
flyhoney Posted December 23, 2008 Share Posted December 23, 2008 This is a javascript question You will need to hook the onekeypress event and check if the key entered was '13' aka 'Enter'. Link to comment https://forums.phpfreaks.com/topic/138206-enabling-enter-button-on-submitting-a-form/#findComment-722532 Share on other sites More sharing options...
revraz Posted December 23, 2008 Share Posted December 23, 2008 Simple search returned http://www.htmlgoodies.com/beyond/javascript/article.php/3472341 Link to comment https://forums.phpfreaks.com/topic/138206-enabling-enter-button-on-submitting-a-form/#findComment-722535 Share on other sites More sharing options...
AjithTV Posted December 23, 2008 Author Share Posted December 23, 2008 Hi I have used 'onkeypress=goReturn()' property but its iving errors. Error: 'event not defined'. Here is the code: function goReturn() { getEvent=event.keyCode; if (getEvent == "13") { document.myform.submit(); return false; } else { return true; } } I have also checked with 'onUnfocus' property. It is also not working.Please help. Link to comment https://forums.phpfreaks.com/topic/138206-enabling-enter-button-on-submitting-a-form/#findComment-722573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.