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

Radconfirm doesn't get the focus

3 Answers 28 Views
Window
This is a migrated thread and some comments may be shown as answers.
Petr
Top achievements
Rank 1
Petr asked on 21 Aug 2015, 02:41 PM
Hi, I have a problem with radconfirm dialog. I open the dialog from C# code by:

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirmQuantity", "confirmQuantityCorrection();", true);

My function is very simple in javascript:

function confirmQuantityCorrection(){
  var oConfirm = radconfirm('Are you sure', confirmCallBackQuantity, 280, 150, null, 'Confirm');
 
  return false;
}


It works fine, but I noticed that I have no focus in confirmation dialog so it is not possible to use only keyboard for confirmation. Focus remains in the main window. I find this post , but it doesn't work and I cannot get the focus.

It looks other people has the similar problem with window opening, but the solution doesn't work for dialog.
Do you have similar problems? Did you find any solution for it?

Thanks a lot,
Petr

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 26 Aug 2015, 09:50 AM
Hello Petr,

The OK button should be focused by default. Nevertheless, you can manually focus it when the window is shown. For instance, if you want to focus the Cancel button, you can use the following approach:
<telerik:RadWindowManager ... OnClientShow="windowShown">
JavaScript:
function windowShown(sender, args) {
    var content = sender.get_contentElement();
    if (content.id.indexOf("confirm") == 0) {
        setTimeout(function () {
            // change 1 to 0 to focus the OK button
            $(content).find(".rwPopupButton")[1].focus();
        }, 20);
    }
}

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Petr
Top achievements
Rank 1
answered on 26 Aug 2015, 12:05 PM

Hello Eyup,

 I play with it. I tried to hide modal dialog which invoked the confirm dialog and I put timeout in function:

function confirmQuantityCorrection(){
   $("#myForm").parent().css('display','none')
  var oConfirm = radconfirm('Are you sure', confirmCallBackQuantity, 280, 150, null, 'Confirm');
 
  setTimeout(function () {         
    $('.radconfirm').find('.rwPopupButton')[0].focus();         
  }, 100);‚Äč
  return false;
}

 

I find that this solution works only in Chrome. It doesn't work in FF and IE.

Any idea what can be wrong?

 

Thank you

0
Eyup
Telerik team
answered on 31 Aug 2015, 06:50 AM
Hi Petr,

I am sending a sample web site to demonstrate that the suggested web site sample should work as expected. Please run the attached application and let me know about the result.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Window
Asked by
Petr
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Petr
Top achievements
Rank 1
Share this question
or