How to change TextBox input language to Persian as you type in

I am working on a website in which users should fill some fields in different languages.
I don’t want the users to change their writing language using Alt+Shift key combination but rather i want the input language to be changed automatically to either Persian or English.

Is there any way to do that?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

1- Download Farsi type java script file

After you downloaded the file, attach it to the head section of your html page.

<Head>
<script src="farsitype.js" type="text/javascript"></script>
<!-- Other tags are omitted to reduce complexity -->
</Head>

Now all you have to do is to create a text box and set its Lang attribute to “fa-IR”.

<input type="textbox" name="text1" Lang="fa-IR" />

or

<asp:TextBox ID="txt_name" runat="Server" Lang="fa-IR" />

Load your page and it’s done!


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x