I want to filter and lock a input text. For example, in some input, a user can only type Persian/Farsi characters but not English, or when user can type in English but not Persian. Means some input only accepts Persian/Farsi characters and others only accept English.
Also i foundthis http://www.thimbleopensource.com/tutorials-snippets/jquery-plugin-filter-text-input. If know any regular experssion for persian characters can help me or how can change the keyboard mode.
thanks.
According to the list of Unicode characters it seems you need to check symbols in the unicode range U+0600-U+06FF.
So if you want to prevent the insertion of every other unicode symbol you could simply check your input value against /^[\u0600-\u06FF]+$/g regular expression. Also note that there're many unicode ranges you may want to allow. From the page of Arabic charset in Unicode, beside Arabic (0600—06FF, 225 characters) you have
in that case add as many ranges as you need in the expression:
e.g. /^[\u0600-\u06FF\u0750-\077F\u0...]+$/g
So, using the snippet you mentioned you should write
$('#text_input').filter_input({regex:'[\u0600-\u06FF\u0750-\077F\u0...]'});
Hope this helps. السلام عليكم
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With