I have a problem and I'm not sure whether it's Dot Net or Javascript so I'm
posting here.
I have a web page with a text field and a custom validator. The validator
points to a javascript function. The idea is to prevent saving of entries
that are less than 6 characters. The function works fine as long as there is
at least 1 character in the field. What I cannot understand is why it does
not fire at all if the textbox is blank. Here's the code. I put in an alert
to check if it was being called. (Perhaps I should mention that I am an
absolute beginner in Javascript.)
function ValidateLicense(sender,args)
{
var r = document.getElementById("<%= driversLicense.ClientID %>");
args.IsValid = true;
// window.alert(r.value.length);
if (r.value.length < 6)
{
args.IsValid = false;
}
}