...

View Full Version : form validation



sybil6
10-10-2008, 09:12 PM
i would like to perform a form validation so the user cannot enter \t (tab horyz) (space bar) is it possible to do without regular expressions,i got someting like this this:

if(document.form1.nom.value.length==0 || document.form1.nom.value=='\x00' ){
errmsg3();
return false;
}

the \x00 value is what represents \t in hexadecimal i think, so i am tryng to do the validation this way but does not work.

rangana
10-11-2008, 05:03 AM
Have you tried on checking for whitespace instead:


if(document.form1.nom.value.length==0 || document.form1.nom.value==' ' ){

sybil6
10-11-2008, 02:10 PM
hello,

yes i tried that and does not work , i will have to do some classic trim function with regex.I was hoping my approach could work..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum