I have a little jQuery (1.6.2) script that changes the input submit value to “Sending…” and prevents it from working without a selected image.
$('form#upload').submit(function(event)
{
event.preventDefault();
var image = $('input[name="image"]');
var upload = $('input[name="upload"]');
if (image.val())
{
upload.val('Sending...');
this.submit();
}
});
image is an input file, upload is the input submit. It works fine in Chrome, but Firefox (5.0) does not send the input submit in the POST, only the image, which causes my server side script to fail. I could work around that, but I’d like to know if I can fix that and I can’t seem to find anything on it.
Simply remove the unconditional
event.preventDefault();and only call it if the form should not be submitted.