alleyCat Posted May 4, 2006 Share Posted May 4, 2006 Hi there, anybody has any suggestion of how to submit the form when user press enter, the form itself contains select field, the text fields submited when i press enter, however, the select fields don't go anywhere. Link to comment Share on other sites More sharing options...
scott100 Posted May 4, 2006 Share Posted May 4, 2006 Does this help you? <head><script type="text/javascript"><!--function initPage() { window.document.onkeydown=findKey;}function findKey(evt) { var evt = (evt) ? evt : ((window.event) ? event : null); if (evt.type == 'keydown') { var charCode = (evt.charCode) ? evt.charCode : evt.keyCode; if (charCode==13){alert("you pressed return");document.input.submit()} }}// --></script></head><body onload="initPage()"> <form name="input" action="process.asp" method="get">Username: <input type="text" name="user"><input type="submit" value="Submit"></form> </body></html> Link to comment Share on other sites More sharing options...
alleyCat Posted May 4, 2006 Author Share Posted May 4, 2006 sorry , i'm afraid that's not what i want.,...thank you anyway.. Link to comment Share on other sites More sharing options...
scott100 Posted May 4, 2006 Share Posted May 4, 2006 sorry , i'm afraid that's not what i want.,...thank you anyway..<{POST_SNAPBACK}> sorry, so your problem is that the select field does not get passed?i have added a select and it works ok<head><script language="JavaScript" type="text/javascript"><!--function initPage() { window.document.onkeydown=findKey;}function findKey(evt) { var evt = (evt) ? evt : ((window.event) ? event : null); if (evt.type == 'keydown') { var charCode = (evt.charCode) ? evt.charCode : evt.keyCode; if (charCode==13){alert("you pressed return");document.input.submit()} }}// --></script></head> <body onload="initPage()"> <form method="post" action="http://pict.paisley.ac.uk/cgi-davison/reflect.cgi" name="input"><select name="Select"><option value="hi">hi</option><option value="hello">hello</option></select><input type="submit" value="Submit"></form> </body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now