List Info

Thread: English Characters (ONLY) on form fields!




English Characters (ONLY) on form fields!
user name
2007-01-03 21:05:07
With some initial testing with Gan, Hakka, Manadarin and
Catonese
chars you can use a simple regex that will not match on the
multibyte
chars. Something like this:

Hope it may help or at least give you a starting point

function englishOnlyChars() {
  var matchString = new RegExp("[a-zA-Z0-9]");

  if (document.myForm.test.value.match(matchString))
   {
     // contains ASCII chars, probably safe to assume not
mixed with
multibyte chars
       return true
     }
  else
   {
   // No ASCII chars found at all, tsk tsk
       return false
     }
 }

Robert Bailey

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http:
//ad.doubleclick.net/clk;56760587;14748456;a?http://www.adob
e.com/products/coldfusion/flex2/?sdid=LVNU

Archive: http://www.houseoffusion.com/groups/Jav
ascript/message.cfm/messageid:3456
Subscription: http://www.houseoffusion.com/groups/Javascript/subsc
ribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/u
nsubscribe.cfm?user=22184.15789.33
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )