Grace
Grace

Reputation: 1265

how to change textbox input language in web application

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 ?

Upvotes: 10

Views: 7786

Answers (5)

Ali.Rashidi
Ali.Rashidi

Reputation: 1462

a better solution may be:

Farsi type java script code

Upvotes: 3

Jahan Zinedine
Jahan Zinedine

Reputation: 14874

Refer 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");
});

Upvotes: 5

Mikael Svenson
Mikael Svenson

Reputation: 39695

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.

Upvotes: 0

annakata
annakata

Reputation: 75872

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.

Upvotes: -1

Darin Dimitrov
Darin Dimitrov

Reputation: 1039508

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.

Upvotes: 0

Related Questions