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

Radgrid unable to set focus to a textbox in editmode in clientside using javascript

3 Answers 228 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pabanas
Top achievements
Rank 1
Pabanas asked on 10 May 2009, 02:07 PM
Hai ,

          I have Radgrid with 4 columns all are Radnumberictextboxes with onload , onfocus and onblur event handler in it . I tried to retain focus on the second textbox  in onblur event of the radnumeric text box becasue of invalid input by user using the following code .

<script type="text/javascript" language="javascript" >

Function Blur(sender, args) {

      var input_value = sender.GetValue() ;

        if  ( input_value    any condition   ) {
        
           var senderid = sender.get_id();
            document.getElementById(senderid).focus();
          }
                 
        }

</script>

  I get the following error when I debug in IE .

htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.

  How do i retain focus using clientside script ?

  Thank you .













3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 May 2009, 07:19 AM
Hello Pabanas ,

I will suggest you to use the client-side API of the RadNumericTextBox control. Here is a code snippet showing how to achieve this:
... 
$find(senderid).focus(); 
... 

Kind regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Michael
Top achievements
Rank 1
answered on 02 Nov 2011, 07:02 PM
Hi,

I am getting the same error:

function RadComboBox1_ClientSelectedIndexChanged(sender, args) {
            var selectedRadGridEditRow = args.get_item();
            var textBox1 = $get(sender.get_id().replace("RadComboBox1", "TextBox1"));
            textBox1.value = selectedRadGridEditRow.get_attributes().getAttribute("JobTitle");
            textBox1.focus();
        }

textBox1
.value
 call works just fine, the value gets set. But when I call the textBox1.focus(), I get the htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus error message.

How do I resolve that?
0
yakesh
Top achievements
Rank 1
answered on 27 Oct 2017, 01:10 PM

Hi friends,

I have an rad numeric text box ,I tried to set focus on text box ,it doesn't work on edge browser.

i used this code

function FocusUnitcost(sender, args) {
    var input = sender.get_value();
           sender.focus();
        sender.selectAllText()
    }

Regards,

Yakesh babu D

 

Tags
Grid
Asked by
Pabanas
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Michael
Top achievements
Rank 1
yakesh
Top achievements
Rank 1
Share this question
or