G
Gary
Morning all,
I have a form field called:
Bsk01
How do I onBlur prompt the user to enter a ZERO as character one, if one is
not already entered. At the same time, I would like to ensure at least 5t
characters have been entered. This validation should also only trigger if
anything is entered. Basically, if the user chooses to enter nothing then
the check should not be carried out and the user should be able to continue.
So in pseudo style:
If user data IS ENTERED AND DOES NOT contain a ZERO as first character, or
is LESS THAN 5 characters long, prompt for re-entry.
Thanks guys, been trying various things and got close, but have hit a brick
wall.
This ALMOST works:
function checkField()
{if (document.form1.Bsk01.value.length<9) {alert("Please enter a valid code.
The first character should be a zero.")}else if
(/^0.*$/.test(document.form1.Bsk01.value)){return;}else{alert("Please enter
a valid code. The first character should be a zero.")}}
Gary.
I have a form field called:
Bsk01
How do I onBlur prompt the user to enter a ZERO as character one, if one is
not already entered. At the same time, I would like to ensure at least 5t
characters have been entered. This validation should also only trigger if
anything is entered. Basically, if the user chooses to enter nothing then
the check should not be carried out and the user should be able to continue.
So in pseudo style:
If user data IS ENTERED AND DOES NOT contain a ZERO as first character, or
is LESS THAN 5 characters long, prompt for re-entry.
Thanks guys, been trying various things and got close, but have hit a brick
wall.
This ALMOST works:
function checkField()
{if (document.form1.Bsk01.value.length<9) {alert("Please enter a valid code.
The first character should be a zero.")}else if
(/^0.*$/.test(document.form1.Bsk01.value)){return;}else{alert("Please enter
a valid code. The first character should be a zero.")}}
Gary.