AJAX version of WebForm_FireDefaultButton is incompatible with Firefox

Last post 04-16-2009 2:03 AM by Vince Xu - MSFT. 2 replies.

Sort Posts:

  • AJAX version of WebForm_FireDefaultButton is incompatible with Firefox

    04-13-2009, 3:35 PM
    • Member
      point Member
    • philw_v2
    • Member since 04-13-2009, 7:24 PM
    • Posts 2

    After installing the AJAX Extensions 1.0 for the 2.0 Framework I started noticing odd behavior in Firefox. Specifically hitting enter in a textarea resulted in a postback rather than a new line. When testing on a machine that does not have the AJAX Extensions installed I do not encounter an error. Upon further inspection it looks like the WebForm_FireDefaultButton method is not the same on the two machines. On the working machine it looks like:

     function WebForm_FireDefaultButton(event, target) {
        if (event.keyCode == 13) {
            var src = event.srcElement || event.target;
            if (!src || (src.tagName.toLowerCase() != "textarea")) {
                var defaultButton;
                if (__nonMSDOMBrowser) {
                   defaultButton = document.getElementById(target);
                }
                else {
                    defaultButton = document.all[target];
                }
                if (defaultButton && typeof(defaultButton.click) != "undefined") {
                    defaultButton.click();
                    event.cancelBubble = true;
                    if (event.stopPropagation) event.stopPropagation();
                    return false;
                }
            }
        }
        return true;
    }

     

    on the machine that has the AJAX Extensions installed it is as follows:

    function WebForm_FireDefaultButton(event, target) {
            if (event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea"))) {
            var defaultButton;
            if (__nonMSDOMBrowser) {
                defaultButton = document.getElementById(target);
            }
            else {
                defaultButton = document.all[target];
            }
            if (defaultButton && typeof(defaultButton.click) != "undefined") {
                defaultButton.click();
                event.cancelBubble = true;
                if (event.stopPropagation) event.stopPropagation();
                return false;
            }
        }
        return true;
    }

    I believe Firefox does not support event.srcElement and that is why the first method also checks even.target. Has the AJAX Extension reintroduced an old browser incompatibility into the Framework? Is this a known issue? If so is there a fix other than including my own javascript?

  • Re: AJAX version of WebForm_FireDefaultButton is incompatible with Firefox

    04-14-2009, 10:59 AM
    • Member
      point Member
    • philw_v2
    • Member since 04-13-2009, 7:24 PM
    • Posts 2

    Running Windows updates resolved the issue. After installing "Microsoft .NET Framework 3.5 Service Pack 1 and .NET Framework 3.5 Family Update (KB951847)" on the problematic machine the incorrect javascript was corrected.

     
    A little more detail:

    On the machine I encountered a problem the System.Web.dll was version 2.0.50727.1433. After the update it is now version 2.0.50727.3082.

    On the machine that worked without issue the System.Web.dll is version 2.0.50727.3053




     

  • Re: AJAX version of WebForm_FireDefaultButton is incompatible with Firefox

    04-16-2009, 2:03 AM
    Answer

    Hi,

    If you used apply framework 3.5 in your application, you need deploy related version of web.dll as the assembly reference in web.config.


    Vince Xu
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (3 items)