Jump to content

how to submit form has select fiel by press enter


alleyCat
 Share

Recommended Posts

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

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

sorry , i'm afraid that's not what i want.,...thank you anyway..

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...