Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 903
Ali.Rashidi Avatar asked Aug 04 '13 08:08

Ali.Rashidi


1 Answers

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!

like image 141
Ali.Rashidi Avatar answered Oct 06 '22 00:10

Ali.Rashidi