Autocomplete and User define keyboard

Posted by Geetha on Stack Overflow See other posts from Stack Overflow or by Geetha
Published on 2010-04-08T10:10:47Z Indexed on 2010/04/08 10:13 UTC
Read the original article Hit count: 221

Filed under:
|
|

Hi All,

I am using asp:button to create a keyboard with A-Z and 0-9 for touch screen using Java script. This keyboard is linked with one textbox. If we click one button corresponding text will be displayed on the textbox. Its working fine. I have included the autocomplete feature to this textbox using jquery JQuery Autocomplete.

Problem:

  1. The autocomplete is not working if i my user define keyboard. How to modify my key buttons as keyboard keys? Is it possible? Is there any other way to achieve this?

Code:

 <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>

 <asp:Button ID="zero" runat="server" Text="0" CssClass="myclass" OnClientClick="return typeLetter(this);" TabIndex="20"/>

   function typeLetter(currentbutton) {
         if (previousActiveElement != null) {
             if (previousActiveElement == 'antSearchText'){

                 var position = document.getElementById('position').value;

                 if (position == '') {
                     alert('chk position');
                 } else {
                     var existingString = document.getElementById(previousActiveElement).value;
                     var beforeString = existingString.substring(0, position);
                     var afterString = existingString.substring(position, existingString.length);
                     document.getElementById(previousActiveElement).value = beforeString + currentbutton.value + afterString;
                                                                     setCaretPosition(document.getElementById(previousActiveElement), parseInt(position) + 1);
                     setCaretPosition(document.getElementById(previousActiveElement), parseInt(position) + 1);                         
                 }                     
             }                 
         }             
         return false;
     }

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery