Ok, I've bound a submit event handler to a form. The handler is set up to validate data, then after validation passes disable further form submittal, as well as display a 'Please wait ... processing' message.
Here's the basic structure:
function handler() {
// Validation stuff goes here.
...
// Validation passes, show message and return true.
$('#processing-msg').show(); // Show the 'processing' message.
$form.bind('submit', function() { return false }); // Disable further form submits.
return true; // Proceed with form submittal.
}
Up until the very last return
statement, if I break before return true
, the processing message will show. But if I allow it to return true
the message doesn't show up at all, ever. Also the submit button won't appear disabled (another part of the process). This works in pretty much every browser except Safari. I've tried commenting out the submit-disable logic, but no dice.
Update
I haven't been able to completely re-create the issue on jsfiddle. But here you can see how the order of functions called differs in Safari (alerts()
happen before message is displayed): http://jsfiddle.net/skttw/3/