This is a migrated thread and some comments may be shown as answers.

Rad combobox curser position

3 Answers 97 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
siva
Top achievements
Rank 1
siva asked on 18 Feb 2009, 02:34 AM
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

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Feb 2009, 09:20 AM
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.
0
siva
Top achievements
Rank 1
answered on 20 Feb 2009, 09:04 AM
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

0
Jeff
Top achievements
Rank 1
answered on 30 May 2013, 04:27 AM
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.
Tags
ComboBox
Asked by
siva
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
siva
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Share this question
or