By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,453 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,453 IT Pros & Developers. It's quick & easy.

how to include " in my validation script

P: n/a
I wrote this function to validate the name.
//test name for illegal characters
var illegal = "0123456789!@#$%^&*()-=_+[]\{}|;':,./?><";
for (var i=0;i<strng.length;i++) {
temp = strng.substring(i,i+1);

if (illegal.indexOf(temp) != -1 && strng != "")

{
error = "The name contains illegal characters.\n";
}

How can I include " character in my 'illegal' string.
Are there any other ways to tell string 'illegal' to include only letters.

I am not familiar with this.
If you know any links plesase give it to me.

Thanks
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
VK
function validate (thisString) {
var re = /[^A-Za-z]/g; // creating a regular expression
if (re.test(thisString)) {
error = "The name contains illegal characters.";
}
else {
// everything's fine
}
}

Bartosz Wegrzyn <bl*******@lexon.ws> wrote in message
news:gQ*******************@newssvr28.news.prodigy. com...
I wrote this function to validate the name.
//test name for illegal characters
var illegal = "0123456789!@#$%^&*()-=_+[]\{}|;':,./?><";
for (var i=0;i<strng.length;i++) {
temp = strng.substring(i,i+1);

if (illegal.indexOf(temp) != -1 && strng != "")

{
error = "The name contains illegal characters.\n";
}

How can I include " character in my 'illegal' string.
Are there any other ways to tell string 'illegal' to include only letters.

I am not familiar with this.
If you know any links plesase give it to me.

Thanks

Jul 20 '05 #2

P: n/a
thanks

I found this
http://devedge.netscape.com/library/...p.html#1010922
"VK" <sc**********@yahoo.com> wrote in message
news:3f***********************@news.freenet.de...
function validate (thisString) {
var re = /[^A-Za-z]/g; // creating a regular expression
if (re.test(thisString)) {
error = "The name contains illegal characters.";
}
else {
// everything's fine
}
}

Bartosz Wegrzyn <bl*******@lexon.ws> wrote in message
news:gQ*******************@newssvr28.news.prodigy. com...
I wrote this function to validate the name.
//test name for illegal characters
var illegal = "0123456789!@#$%^&*()-=_+[]\{}|;':,./?><";
for (var i=0;i<strng.length;i++) {
temp = strng.substring(i,i+1);

if (illegal.indexOf(temp) != -1 && strng != "")

{
error = "The name contains illegal characters.\n";
}

How can I include " character in my 'illegal' string.
Are there any other ways to tell string 'illegal' to include only letters.
I am not familiar with this.
If you know any links plesase give it to me.

Thanks


Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.