Saturday, September 12, 2009

FileUpload failed in Firefox worked in IE6, IE7, IE8

I am not a graphics designer and most of what I consider to look professional and clean is not what is approved for a web based user interface. It was therefor a massive pain in my rear end to take a mess of hobbled together presentation that started very clean and concise from an extremely good web designer and was completely mucked up by stakeholders into a CSS 2.1 compliant presentation that looked consistent on IE 6, IE 7, IE 8 and Firefox.
Getting the presentation right for Firefox handled IE 7 actually, but took a lot of work and only minor modification via conditional overriding CSS sheets was needed for IE 8 and IE 6.
The thing was, we found that one particular piece of functionality, an ASP.NET 2.0 Web Application FileUpload process was not working in Firefox.

The cause was the rendering of the HTTPInputButton used to trigger the FileUpload clicked event. The original code which works fin in IEs was

<input type="button" runat="server" id="btnUpload" value="Upload File" onclick="this.disabled=true; this.value='Sending...'; document.aspnetForm.submit();" />

The fix was to switch to call this.click; which renders as a _doPostBack method in IE 6,7,8 and Firefox 3.5.x browsers

<input type="button" runat="server" id="btnUpload" value="Upload File" onclick="this.disabled=true; this.value='Sending...'; this.click;" />

I’ve found a lot of resizing issues to cope with, but at least the functionality is back on track.

No comments: