B
Blue®
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="JavaScript1.2">
function checkpostal(){
var re5digit=/^\d{5}$/ //regular expression defining a 5 digit number
if (document.myform.RecordID.value.search(re5digit)==-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="checkpostal()" 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="JavaScript1.2">
function checkpostal(){
var re5digit=/^\d{5}$/ //regular expression defining a 5 digit number
if (document.myform.RecordID.value.search(re5digit)==-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="checkpostal()" value="check">
</form>
</body>
</html>