T
Tony Johansson
Hello!
In lack of a better construction I use this small snipped where I replace
every character with a empty string ("") that is anything other then numeric
character 0-9 ot dot or comma.
As you can see in this statement after g, I have '' which replace invalid
character with empty string.
I hope there is a shorter construction where I can find invalid character to
be replaced with ''.
This construction says if enter character is within this
(/[A-Za-z;:_!@£#¤%&/()=}{'`´€+*?\\[$-]
replace this character with empty character ''.
So if I replace this (/[A-Za-z;:_!@£#¤%&/()=}{'`´€+*?\\[$-]
with
(/ \D]
all work quite fine except that dot and comma is filtered out which I don't
want.
<input type="text" name="depthBow" id="txtDepthBow" size="20" onkeyup="if
(/[A-Za-z;:_!@£#¤%&/()=}{'´`€+*?\\[$-]/g.test(this.value)) this.value =
this.value.replace(/[A-Za-z;:_!@£#¤%&/()=}{'`´€+*?\\[$-]/g,'')" />
//Tony
In lack of a better construction I use this small snipped where I replace
every character with a empty string ("") that is anything other then numeric
character 0-9 ot dot or comma.
As you can see in this statement after g, I have '' which replace invalid
character with empty string.
I hope there is a shorter construction where I can find invalid character to
be replaced with ''.
This construction says if enter character is within this
(/[A-Za-z;:_!@£#¤%&/()=}{'`´€+*?\\[$-]
replace this character with empty character ''.
So if I replace this (/[A-Za-z;:_!@£#¤%&/()=}{'`´€+*?\\[$-]
with
(/ \D]
all work quite fine except that dot and comma is filtered out which I don't
want.
<input type="text" name="depthBow" id="txtDepthBow" size="20" onkeyup="if
(/[A-Za-z;:_!@£#¤%&/()=}{'´`€+*?\\[$-]/g.test(this.value)) this.value =
this.value.replace(/[A-Za-z;:_!@£#¤%&/()=}{'`´€+*?\\[$-]/g,'')" />
//Tony