Melissahomes
Programmer
I have 2 asp pages. Search.asp, formsearch.asp
I want to form to submit when I hit enter. It seems to submit on enter and goes to the formsearch.asp but nothing happends. But when I hit submit button it works fine. Can someone tell me what's wrong? Thanks guys.
Search.asp (code)
<html>
<head>
<SCRIPT LANGUAGE="javascript">
function send()
{document.form1.submit()}
</SCRIPT>
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" action="formsearch.asp">
<input name="searchCriteria" type="text" onUnfocus="send()">
<select name="site" id="site">
<option value=" <option value=" <option value=" Dictionary</option>
<option value=" Info</option>
<option value=" Dictionary</option>
<option value=" Thesaurus</option>
</select>
<input name="Search" type="submit" id="Search" value="Search">
</form>
</body>
</html>
formsearch.asp (code)
<%
if len(request.form("Search")) then
dim newRoute
newRoute = request.form("site")
newRoute = newRoute & server.URLEncode(request.form("searchCriteria"))
response.redirect(newRoute)
end if
%>
I want to form to submit when I hit enter. It seems to submit on enter and goes to the formsearch.asp but nothing happends. But when I hit submit button it works fine. Can someone tell me what's wrong? Thanks guys.
Search.asp (code)
<html>
<head>
<SCRIPT LANGUAGE="javascript">
function send()
{document.form1.submit()}
</SCRIPT>
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" action="formsearch.asp">
<input name="searchCriteria" type="text" onUnfocus="send()">
<select name="site" id="site">
<option value=" <option value=" <option value=" Dictionary</option>
<option value=" Info</option>
<option value=" Dictionary</option>
<option value=" Thesaurus</option>
</select>
<input name="Search" type="submit" id="Search" value="Search">
</form>
</body>
</html>
formsearch.asp (code)
<%
if len(request.form("Search")) then
dim newRoute
newRoute = request.form("site")
newRoute = newRoute & server.URLEncode(request.form("searchCriteria"))
response.redirect(newRoute)
end if
%>