Guest_imported
New member
- Jan 1, 1970
- 0
I'm trying to validate a text field (and form) and check to see whether it contains 'illegal' characters.
The lines:
if (ctitle.indexOf("!"
!= -1){errormsg += "\n -> The title cannot contain a '!'"}
if (ctitle.indexOf("@"
!= -1){errormsg += "\n -> The title cannot contain a '@'"}
if (ctitle.indexOf("/"
!= -1){errormsg += "\n -> The title cannot contain a '/'"}
works fine, but when I try to use:
if (ctitle.indexOf("\"
!= -1){errormsg += "\n -> The title cannot contain a '\'"}
I get an "illegal character" from the browser. Obviously its to do with "\" but I'm not sure how to fix it. Can someone please tell me how to get around this! Thanks, any help is much appreciated.
The lines:
if (ctitle.indexOf("!"
if (ctitle.indexOf("@"
if (ctitle.indexOf("/"
works fine, but when I try to use:
if (ctitle.indexOf("\"
I get an "illegal character" from the browser. Obviously its to do with "\" but I'm not sure how to fix it. Can someone please tell me how to get around this! Thanks, any help is much appreciated.