Open Bug 472065 Opened 17 years ago Updated 3 years ago

Firefox does a double postback

Categories

(Core :: DOM: Core & HTML, defect)

1.9.0 Branch
All
Windows Vista
defect

Tracking

()

UNCONFIRMED

People

(Reporter: ehioze, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 (.NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 (.NET CLR 3.5.30729) Firefox does a double postback. When i put a disable button in .net as string clickHandler = string.Format( "document.body.style.cursor = 'default'; this.value='Please wait... While we try to upload your numbers'; this.disabled = true; {0};", this.ClientScript.GetPostBackEventReference(Button1, string.Empty)); Button1.Attributes.Add("onclick", clickHandler); Reproducible: Sometimes Steps to Reproduce: 1. click on submit 2. ff submits twice 3. Actual Results: Firefox does a double postback ff submits twice Expected Results: ff should submit once see discussed details here http://forums.asp.net/t/1364753.aspx
Component: General → HTML: Form Submission
Product: Firefox → Core
QA Contact: general → form-submission
Version: unspecified → 1.9.0 Branch
I have the same problem with the same disable script. I noticed the problem goes away when I remove the UpdatePanel from the page.
I've noticed that the problem isn't linked to the disable script itself. It seems to be the GetPostBackEventReference which is causing the problem. I was able to repro the problem by using the following simple example: // In the page aspx.cs file, apply the script to the button. Btn is the button I want to disable ApplyDisableButtonScript(btn, Page, "Please Wait..."); // This method applies the script to buttons public static void ApplyDisableButtonScript(Button btn, Page page, string disabledText) { btn.Attributes.Add("onclick", "DisableClick(this, '" + disabledText + "');" + page.ClientScript.GetPostBackEventReference(btn, string.Empty) + ";"); } // And this is the script... Notice how it is all commented out and the problem still occurs function DisableClick(obj, disabledText) { //if (typeof(Page_ClientValidate) == 'function') //{ // if (Page_ClientValidate() == false) // return false; //} //if (disabledText != "") // obj.value = disabledText; //obj.disabled = true; } So the problem seems to be a more fundamental one due to the way Firefox handles this...
This is definitely a fundamental way in which Firefox handles this as all other browsers do a single postback. If you add "return false;" to the end of the script, then a single postback will occur. This will work with all browsers. Ex: btnSubmit.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(btnSubmit, "") + ";this.value='Processing...';this.disabled = true;return false;")
Component: HTML: Form Submission → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.