Hi All
Regexp go me confused. I need to filter some characters out of a text box with regexp. I have the follwoing code
I can't seem to get the regexp to test properly. Where I am going wrong?
TIA
Bastien
I wish my computer would do what I want it to do,
instead of what I tell it to do...
Regexp go me confused. I need to filter some characters out of a text box with regexp. I have the follwoing code
Code:
function checkString(s,oElement)
{
var thisKey = s.value;
myRegExp = /'&<>"/i;
if (myRegExp.test( thisKey ))
{
alert("You have entered an invalid character in the field.\n\nYou are not allowed to use the following characters in the name.\n\n\tless than symbol( < ) \n\tgreater than symbol ( > ) \n\t ampersand ( & ) \n\tsingle quote( ' ) \n\tdouble quote ( \" )\n\nPlease adjust your entry.");
document.getElementById(oElement).focus();
clearField(oElement);
}
}
called by:
<input type="textbox" name="base_value_1" id="base_value_1" value="something" onkeyup="checkString(this,'base_value_1');">
I can't seem to get the regexp to test properly. Where I am going wrong?
TIA
Bastien
I wish my computer would do what I want it to do,
instead of what I tell it to do...