Forms: Setting Value Limits?

liunx

Guest
I am building a submit form with a single field for entry. I need to designate a specific value range as true and a specific value range as false. I want the user-defined number to be verified at the time of submission. If false, I would like to display a text message, and if true, I need the user to be linked to another page. <br />
<br />
Can someone help me with the code to do this? I am more familiar with HTML, but if Javascript is the answer, so be it. Thanks.<!--content-->What do you mean by a specific value range? Is this a CGI form using PERL to parse it?<br />
<br />
Regards,<br />
Kevin<!--content-->Let me try that again:<br />
<br />
Imagine a page where a user must agree to the terms set forth in an "entry agreement". To signify their acceptance they must provide a number unique to them. This number, in order to validate their entry, can only fall within a certain value range (i.e.- b/t 1-10); once a number true to the designated range has been provided, they will be linking into another htm page. If the number they provide is not w/i the range, then they should not be allowed to proceed further and should recieve a message telling them so.<br />
<br />
Does that help clear the confusion?<!--content-->I set up this example to submit the information to a certain page, if the numbers fall between 1 and 10. You could just relocate if you want to.<br />
<br />
<html><br />
<head><br />
<title>Untitled</title><br />
<script language="javascript"><br />
function check_it(){<br />
var entry=(parseInt(document.form1.number.value))<br />
if (isNaN(entry)){<br />
alert("enter a number, yo!");<br />
return;<br />
}<br />
if((entry <= 10) && (entry >=1)){<br />
alert("its between 1 and 10, yo! That's just what I needed to submit.");<br />
document.form1.method="get";<br />
document.form1.action="http://www.eye4u.com";<br />
document.form1.submit();<br />
}else{<br />
alert("its higher than10 or lower than 1, yo!");<br />
document.form1.number.focus();<br />
}<br />
}<br />
</script><br />
</head><br />
<body><br />
<form action="" name="form1"><br />
<input type="text" maxlength=2 name="number">Enter number here<br><br />
<input type="submit" value="submit" onclick="check_it();">&nbsp;&nbsp;<input type="reset"><br />
</form><br />
</body><br />
</html><!--content-->
 
Back
Top