I'm really new to javascript and I'm trying to prevent a textbox from accepting letters and empty values. This is what I have:
function checkInp()
{
var x=document.forms["newPerson"]["ThisBox"].value;
if (isNaN(x) || is_null(x))
{
alert("This box can only contain numeric values");
return false;
}
}
Here is my form tag:
<form name="newPerson" action="newPerson2.php" method="POST" onsubmit="return checkInp();">
This DOES prevent letters from passing through, but it DOES NOT prevent empty values from going through.