busillis Posted March 31, 2009 Share Posted March 31, 2009 if (form.cardnumber.length <16) { document.getElementById("errors").innerHTML += "<p>Invalid card number provided.</p>"; form.cardnumber.focus(); haserror=true; } This doesn't seem to be doing anything, but the other validation ones (such as checking its not empty) is. Any idea? Quote Link to comment https://forums.phpfreaks.com/topic/151970-solved-if-for-checking-string-length-is-not-working/ Share on other sites More sharing options...
Maq Posted March 31, 2009 Share Posted March 31, 2009 if (form.cardnumber.value.length You may also want to check to make sure they only enter digits with regular expressions. Quote Link to comment https://forums.phpfreaks.com/topic/151970-solved-if-for-checking-string-length-is-not-working/#findComment-798069 Share on other sites More sharing options...
busillis Posted March 31, 2009 Author Share Posted March 31, 2009 Wonderful, thank you sir +1 Quote Link to comment https://forums.phpfreaks.com/topic/151970-solved-if-for-checking-string-length-is-not-working/#findComment-798072 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.