1

I'm using jQuery .submit() for some form validation.

The validation has two checks:

  1. Checks for null values in the input files
  2. If not null, compared the selected files against a stored list

The validation functions both work fine, however, the submit event requires two clicks of the submit button to trigger if all the input fields have a value.

$(document).ready(function() {
    $('form').submit(function() {
        alert("Submitted");
    });
});

I even stripped it down and changed to a click function and got the same result.

$(document).ready(function() {
    $('#submitbutton').click(function(){        
        alert("Clicked");        
    }); 
});

Anyone else had this? I'm using IE8.

graphicdivine
  • 10,937
  • 7
  • 33
  • 59
Lymedo
  • 576
  • 9
  • 21
  • I suspect this is related to file uploads. Does the form allow file uploads? – graphicdivine Feb 24 '12 at 07:58
  • Yes, it's handling multiple file uploads from a single form – Lymedo Feb 24 '12 at 11:21
  • Just tested it with only one input and it works fine. So it must be something to do with having multiple file inputs on the same form. No problems in firefox, however, just switching broswer isn't the solution. – Lymedo Feb 24 '12 at 11:31
  • You might, then, want to have a look for a plugin to give IE the ability to upload multiple files into a single input. Other browsers can do this natively with a 'multiple' attribute on the input – graphicdivine Feb 24 '12 at 11:47

1 Answers1

0

It's often being present in IE (IE9 Double Form Submit Issue). I resolved it by adding onsubmit="return false" in form element.

Community
  • 1
  • 1
TOUDIdel
  • 1,322
  • 14
  • 22
  • I think the OP is having the opposite problem: "...the submit event requires two clicks of the submit button to trigger..." – graphicdivine Feb 24 '12 at 07:54