Radconfirm doesn't get the focus

4 posts, 0 answers
  1. Petr
    Petr avatar
    18 posts
    Member since:
    Jul 2015

    Posted 21 Aug 2015 Link to this post

    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

  2. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 26 Aug 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Petr
    Petr avatar
    18 posts
    Member since:
    Jul 2015

    Posted 26 Aug 2015 in reply to Eyup Link to this post

    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

  5. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 31 Aug 2015 Link to this post

    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
Back to Top