Avatar of Ryan Rood
Ryan Rood
Flag for Canada

asked on 

Submit Form Using Enter Or Clicking Submit

Hello,

I have a form that I am submitting (see code attached), however when I press enter it just refreshes the page and doesn't actually submit the form. I find this very inconvenient as I myself always use the enter key. We use IE6 or IE7.

Any advice on how to correct this behaviour?

Thanks,
Ryan
<html>
<title>Customer Search</title>
<body background="../background.png" onLoad=dofo() alink="blue" vlink="blue">
<head>
<script type="text/javascript">
 
function dofo() {
	document.fo.keyword.focus();
}
 
</script>
</head>
<div align="center">
<a href="http://intranet/search"><img src="../logo.png" border="0" alt=""></a>
<br>
 
 
<tr>
	<td><a href="#" onClick="history.go(-1)">Back</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://intranet" alt="Intranet Home">Home</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="list_all.php">Show All</a></td>
</tr>
<form name="fo" method="POST" action="search.php">
	<table>
		<strong>Enter Customer Information</strong><br><br>
		<input type="text" name="keyword" size="20" maxlength="100">
		<input type="submit" name="submit" value="Search" />
	</table>
</form>
</div>
</body>
</html>

Open in new window

PHPScripting Languages

Avatar of undefined
Last Comment
Ryan Rood

8/22/2022 - Mon