perlmonger: (bleurgh)
perlmonger ([personal profile] perlmonger) wrote2007-04-26 07:03 pm

irritation

Got a file upload form. Form got an onsubmit handler that (amongst other things) displays an “uploading file” message in the status div on the page and hides the form until the upload is complete, to stop it being fiddled with in the interim. There’s a lot more going on than this, but that’s the nub.

Testity Test McTest

Get round to Safari. Does it work? Does it fsck: target reports “no file uploaded”. I change the action to a CGI parameter dump script and yes, sure enough, in Safari the file field in the form is missing. All the the other form fields are there, populated as they should be, but no file. It sees the submit as multipart/form-data but file field there not is.

I ponder and, being as such peculiarities are in mind as I’ve also just being dealing with dynamically created invisible iframes, I try not hiding the form. Bingo: Safari works again. It seems that Safari (2.0.4 at any rate) craps on file fields if the submitting form is hidden (display: none or visibility: hidden) between the user clicking on submit and the onsubmit handler returning true.

Cue a couple of “if (!khtml)” checks. I suppose I could bung a layer on top of the form instead of just leaving it be, but TBH I can’t be arsed; it is, after all, a graceful enough interface degradation. But this sort of thing offends me.

[identity profile] thunderbox.livejournal.com 2007-04-26 06:31 pm (UTC)(link)
This isn't about cats at all, is it?