Click to See Complete Forum and Search --> : Javascript Filtering Metacharacters Help


jennAshton
05-08-2003, 05:20 PM
Hi Guys,

I would like to have a script where users can not type in any metacharacters such as <>$%& in my form input. How do I go about doing this?

So, far this is all I have is a function call, but how would I execute the script?

Thanks ahead. ;)



function RemoveBad(InStr){
InStr = InStr.replace(/\</g,"");
InStr = InStr.replace(/\>/g,"");
InStr = InStr.replace(/\"/g,"");
InStr = InStr.replace(/\'/g,"");
InStr = InStr.replace(/\%/g,"");
InStr = InStr.replace(/\;/g,"");
InStr = InStr.replace(/\(/g,"");
InStr = InStr.replace(/\)/g,"");
InStr = InStr.replace(/\&/g,"");
InStr = InStr.replace(/\+/g,"");
return InStr;
}

jennAshton
05-08-2003, 06:02 PM
Wow, thanks dave! You're the best!