Rad combobox curser position

4 posts, 0 answers
  1. siva
    siva avatar
    12 posts
    Member since:
    Feb 2009

    Posted 17 Feb 2009 Link to this post

    Hi
      I am using RAD combo box.  And i have set allowCustomeText =true , and i have made the combo to look like textbox.
    On focus of the control the entire text get selected.
      Can you tell me is there any setting to set the cursor to the last position of the combo.

    Thanks
    Siva Kumar
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Feb 2009 Link to this post

    Hi SivaKumar,

    Try attaching following JavaScript to OnClientFocus of RadComboBox.

    Javascript:
    <script type="text/javascript">  
    function OnClientFocus(sender, args)  
    {  
        var comboBox = $find("<%=RadComboBox1.ClientID %>");  
        var input = comboBox.get_inputDomElement();  
        if (input != null && input.value.length > 0)  
        {  
            if (input.createTextRange)  
            {  
                var FieldRange = input.createTextRange();  
                FieldRange.moveStart('character', input.value.length);  
                FieldRange.collapse();  
                FieldRange.select();  
            }  
        }  
    }  
    </script> 

    Thanks,
    Princy.
  3. siva
    siva avatar
    12 posts
    Member since:
    Feb 2009

    Posted 20 Feb 2009 Link to this post

    Hi Princy,
    Thanks for your  response. But  am getting "Object doesn't support this property or method" error here. get_inputDomElement.
    I got  one more solution from my team mate poornima , which is simple and easy..

    On client focus just call the following method. OnClientFocus

    // This method is used to deselect the text selected by clicking into combobox field
    function OnClientFocus(combobox)
    {
    combobox.SelectText = ClickOverride;
    }
     
        function ClickOverride()
    {
    return false; 
    }

    Thanks 
    Siva kumar KB

  4. Jeff
    Jeff avatar
    1 posts
    Member since:
    May 2011

    Posted 29 May 2013 Link to this post

    I've tried the snippet that you wrote, but it doesn't seem to work.  The focus event is firing and this method appears to work correctly, but it doesn't do anything.
Back to Top