Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 30, 2012 09:50 AM by engineer_prog
Member
34 Points
24 Posts
Dec 24, 2012 11:10 AM|LINK
how to allow user to enter only english & arabic characters
Star
11574 Points
1778 Posts
Dec 24, 2012 12:26 PM|LINK
Hope following will help you
Allow only english and arabic charachters in text box
All-Star
182702 Points
23463 Posts
ASPInsiders
Moderator
MVP
Dec 24, 2012 12:28 PM|LINK
Hi,
you'll need to check each character with a known set of unicode characters:
if ($(this).text().trim().charAt(0) == "\u25B8") { //...
for example.
This is for one character only. If you want to do it for groups then you'll need to make the if statement so that it'll look in ranges.
For Arabic the range is http://en.wikipedia.org/wiki/Arabic_script_in_Unicode#Arabic
For the English part I suggest you make use of a regular expression like [a-zA-Z].
Grz, Kris.
Dec 30, 2012 09:50 AM|LINK
Thanks for your reply
engineer_pro...
Member
34 Points
24 Posts
character validation only
Dec 24, 2012 11:10 AM|LINK
how to allow user to enter only english & arabic characters
Nasser Malik
Star
11574 Points
1778 Posts
Re: character validation only
Dec 24, 2012 12:26 PM|LINK
Hope following will help you
Allow only english and arabic charachters in text box
Skype: maleknasser1
XIII
All-Star
182702 Points
23463 Posts
ASPInsiders
Moderator
MVP
Re: character validation only
Dec 24, 2012 12:28 PM|LINK
Hi,
you'll need to check each character with a known set of unicode characters:
if ($(this).text().trim().charAt(0) == "\u25B8") { //...for example.
This is for one character only. If you want to do it for groups then you'll need to make the if statement so that it'll look in ranges.
For Arabic the range is http://en.wikipedia.org/wiki/Arabic_script_in_Unicode#Arabic
For the English part I suggest you make use of a regular expression like [a-zA-Z].
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
engineer_pro...
Member
34 Points
24 Posts
Re: character validation only
Dec 30, 2012 09:50 AM|LINK
Thanks for your reply