I found this piece of JS which serves exactly what I need. It validates if
the input is exactly five numberic characters.
When it is validated, the form action is not carried out. What should I add
to the code so that the form action is carried out?
P/s: I do not know JS at all.
=============== =============== ====
<html>
<head>
</head>
<body>
<script language="JavaS cript1.2">
function checkpostal(){
var re5digit=/^\d{5}$/ //regular expression defining a 5 digit number
if (document.myfor m.RecordID.valu e.search(re5dig it)==-1) //if match failed
alert("Please enter a valid 5 digit number.")
}
</script>
<form name="myform" ACTION="cgi-bin/dbase/dbase.cgi" METHOD="POST">
<input type="text" name="RecordID" size=15>
<input type="button" onClick="checkp ostal()" value="check">
</form>
</body>
</html>
the input is exactly five numberic characters.
When it is validated, the form action is not carried out. What should I add
to the code so that the form action is carried out?
P/s: I do not know JS at all.
=============== =============== ====
<html>
<head>
</head>
<body>
<script language="JavaS cript1.2">
function checkpostal(){
var re5digit=/^\d{5}$/ //regular expression defining a 5 digit number
if (document.myfor m.RecordID.valu e.search(re5dig it)==-1) //if match failed
alert("Please enter a valid 5 digit number.")
}
</script>
<form name="myform" ACTION="cgi-bin/dbase/dbase.cgi" METHOD="POST">
<input type="text" name="RecordID" size=15>
<input type="button" onClick="checkp ostal()" value="check">
</form>
</body>
</html>
Comment