views:

1793

answers:

1

Hi!

Im currently using this jQuery validate plugin and having an issue in IE where its removing the value of file input fields whilst validating the rest of the form.

This seems to me like an onfocus issue, I select a file to upload, click on another input field and it clears the value - this only happens on the file input fields aswell, any other types of input in the form keep their values fine. I've been playing around with the plugin file and nothing seems to change the fact that its clearing the field, also had a look on google and cant find any help.

I've tested the issue on other browsers and the value remains in place, so its just in IE.

Has any1 else used this plugin and had the same issue?

Any help would be great, thanks :)

+1  A: 

I haven't worked with IE file INPUT elements for awhile, but I think I still remember enough to be helpful.

As I remember it, IE clears any file INPUT that isn't set by IE itself. I think their logic is "file INPUTs should only have valid paths that the user intended, so if a file INPUT is set by JavaScript, assume that it's malicious and clear the INPUT".

So, if your validation logic contains any kind of $("INPUT[type='file']").val(something)-like stuff, that would explain the behavior you saw. Hope that helps.

machineghost