can anybody please show me how can i disable special characters in a textbox/textarea? im still not very skillful in javascript so i wanted to ask anyone to help me,tnx in advance
@KorJul 02.2008 — #[I]Which[/I] special characters? Or maybe it is easier to specify which characters should be allowed. RegExp could be useful for this job
@KorJul 02.2008 — #In works for me. Well yes, I have no Spanish keyboard (thus I can not test onkeyup), but if I copy/paste the characters Ññ, they remain in the field. But it theory should work the same onkeyup as onblur.
@Declan1991Jul 02.2008 — #Maybe use the unicode versions?<i> </i>function valid(f) { f.value = f.value.replace(/[^a-zu00D1u00F10-9]*/ig,''); } I have no Spanish keyboard either, so I cannot check.
@jaghSep 07.2011 — #Thanks, it works. But the space is not allowed to input. I need space to input two names in textbox/textarea (e.g. Maria Ana). How can i define it to this code:
@jwlambJul 01.2013 — #Ok, I've tweaked the code a bit and got it close to where I want it, but some characters are still popping up. How do I limit it to just A-z Ñ ñ - , . ' and spacebar
I don't want numbers or any weird special characters, this is for customers to order uniform nametapes on my website, so just what would be in someone's name including Spanish lettering and hyphenated names. Also if they wanted last, first or Last, F. And anything like O'whatever should also be allowed. When I type it in as:
@cartoon_bagJul 01.2013 — #You could set up a bunch of regular expression that checked for link code and abort the form. E.g. a whole string of things like.