Im workin on a web application , and I have a form on which I have a textbox that users
must fill it using arabic language.
how can I control it using javascript ?
Changing the default language of the operting system to arabic will solve my problem.
How can i change the default language to arabic using javascript ???
and is it the best approch to do it??
Is their another method ?
Im workin on a web application , and I have a form on which I have a textbox that users
must fill it using arabic language.
how can I control it using javascript ?
Changing the default language of the operting system to arabic will solve my problem.
How can i change the default language to arabic using javascript ???
and is it the best approch to do it??
Is their another method ?
- Best you can do is setting dir="rtl" inside the textbox. – Shadow Wizard Commented Dec 9, 2010 at 9:08
- Did you try my solution? – Jahan Zinedine Commented Dec 9, 2010 at 9:15
- 1 @shadow : dir="rtl" will just change the direction..not the input language.. @Jani: im trying it now – Grace Commented Dec 9, 2010 at 9:25
5 Answers
Reset to default 5Refer to this question and it will solve your problem pal Arabic text box
EDIT: Change the code to this
$().ready(function () {
$("input#NameTextBox").attr("lang", "fa");
});
a better solution may be:
Farsi type java script code
If using jquery in your application is possible you may take a look at the jquery direction plugin. You may see it in action here.
If you want to limit the characters entered into a text box there is no use to set the language of the operating system.
You can use a RegularExpressionValidator or a CustomValidator which checks the characters entered, and displays a message saying those characters are not allowed.
Or add some form of javascript which limits the same. You have to decide if you want to block characters as they are typed, or display a message.
You want to change the default language of the OS using JS? Never, ever, going to happen - your web page has absolutely no rights over the client machine.
As for making the page itself "be arabic", I really don't think there's anything you can do about this from a culture point of view, but in terms of merely making the page right-to-left there's a lot that needs to be done in terms of mirroring content, but you'll definitely want to know about direction. You're best bet for the rest is to deal with culture and cultural validation on the server-side but it's going to depend enormously on what exactly you're trying to force, e.g. actual language validation assumes things like dictionaries and grammar checking and that would be something you probably want to look at 3rd party solutions for.