Hi Guys,
I'm having strange problem here. With the below mentioned code if the enter some value in the text box and hit ENTER key the page is reloading automatically with query string. If I enter 323232 in the text field and hit enter the page reloads with url
temp5.asp?text1=323232. What could be the problem ? I don't want anything to happen if I press enter key. How to fix it ?
Thanks
temp5.asp
<%@ Language=VBScript %>
<script language="Javascript">
function validateData() {
if (document.form1.text1.value == "" {
alert("Please enter Number."
return;
}
document.form1.action="Validate.asp";
document.form1.method="post";
document.form1.submit();
}
</script>
<html>
<head> </head>
<body>
<form name=form1>
<table align=center>
<tr>
<td> Number </td>
<td> <input type="text" maxlength="20" size=30 name="text1" id="text1"> </td>
</tr>
</table>
<input type="button" value="GO" onclick="validateData()" id=button1 name=button1>
</form>
</body>
</html>
I'm having strange problem here. With the below mentioned code if the enter some value in the text box and hit ENTER key the page is reloading automatically with query string. If I enter 323232 in the text field and hit enter the page reloads with url
temp5.asp?text1=323232. What could be the problem ? I don't want anything to happen if I press enter key. How to fix it ?
Thanks
temp5.asp
<%@ Language=VBScript %>
<script language="Javascript">
function validateData() {
if (document.form1.text1.value == "" {
alert("Please enter Number."
return;
}
document.form1.action="Validate.asp";
document.form1.method="post";
document.form1.submit();
}
</script>
<html>
<head> </head>
<body>
<form name=form1>
<table align=center>
<tr>
<td> Number </td>
<td> <input type="text" maxlength="20" size=30 name="text1" id="text1"> </td>
</tr>
</table>
<input type="button" value="GO" onclick="validateData()" id=button1 name=button1>
</form>
</body>
</html>