I have a page with one validation in place (must be only numbers), but I would like to add another validation. The second textbox, txtLocator, must have at least 1 number and at least 1 letter to be validated. So, it could be
1M, 1M13, 5RRR34, etc etc...5 would fail, 555 would fail, MMM would fail, M would fail. Any ideas?
Here is my code for the page currently.
1M, 1M13, 5RRR34, etc etc...5 would fail, 555 would fail, MMM would fail, M would fail. Any ideas?
Here is my code for the page currently.
Code:
<html>
<head>
<title>Full Warehouse Scan</title>
</head>
<body OnLoad="SetFocus()">
<form id="frmGeneral" name="frmGeneral" action="FullWarehouseScan.asp" method="post">
<table border="0">
<tr>
<td><font face="verdana" size="1">Part ID</font></td>
<td><input type="text" id="txtPartID" name="txtPartID" size="20" onChange="ValidateNumber()" style="font-family: Verdana; font-size: 8pt"></td>
</tr>
<td><font face="verdana" size="1">Locator</font></td>
<td><input type="text" id="txtLocator" name="txtLocator" size="20" style="font-family: Verdana; font-size: 8pt"></td>
</tr>
</table>
</form>
</body>
</html>
<Script Language="JavaScript">
<!--
function SetFocus()
{
document.frmGeneral.txtPartID.focus();
}
function ValidateNumber()
{
if(isNaN(frmGeneral.txtPartID.value))
{
alert("You must enter a numeric value for a Part ID");
document.frmGeneral.txtPartID.focus();
return(false);
}
}
//-->
</Script>