SPELL CHECK not Working in Safari/Firefox

2 posts, 0 answers
  1. Zash
    Zash avatar
    40 posts
    Member since:
    Aug 2005

    Posted 21 Apr 2011 Link to this post

    your example code works fine in i.e but does not work in non i.e like Safari 5.0, Firefox

    The probelm is in the following function,  document.getElementById(buttonID) not being supported by Safari or Firefox browser

    because document.getElementById(buttonID) does not return object.

    What would be the work around for it in Safari?

     

     

     

    function

    SpellCheckClosed(sender, args) {

     

    if

    (IsChecked) {

     

     

     

    //trigger submit from the update/insert button in the grid

     

     

     

    //the id of the update or insert button is extracted from a hidden field

     

      

     

     

    var buttonID = document.getElementById('<%=HiddenField1.ClientID %>'

    ).value;

     

      

    document.getElementById(buttonID).click();  /// not being supported by non i.e like Safari and firefox

     IsChecked = 

    false ;

     

     

      

    }

     

    }

    Thanks

     

     

  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 25 Apr 2011 Link to this post

    Hi Zash,

    This is a browser behavior. You can find information how to fix it in the following article: Fix for Firefox click() event issue as well as alternative for .click() method in firefox.
    Copy Code
    function SpellCheckClosed(sender, args)
    {
        if (IsChecked)
        {
            //trigger submit from the update/insert button in the grid
            //the id of the update or insert button is extracted from a hidden field
            var buttonID = document.getElementById('<%=HiddenField1.ClientID %>').value;
            //document.getElementById(buttonID).click();
            if ($get(buttonID).dispatchEvent) {
                var e = document.createEvent("MouseEvents");
     
                e.initEvent("click", true, true);
                $get(buttonID).dispatchEvent(e);
     
            }
     
            else {
                $get(buttonID).click();
     
            }
            IsChecked = false;
        }
    }


    See also this Mozilla's article: https://developer.mozilla.org/en/DOM/element.click.

    All the best,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top