Reputation: 927
http://www.gamereview.tv/email/
The submit button only works once. If there is an error on the first try, you can't click on the button again. When testing, type an invalid email. It shows the prompt, and then after you fix it, the button is no longer working. Why is that?
JavaScript:
$('#submit').click(function() {
$("#message").slideUp(200,function() {
$('#message').hide();
// Kick in Validation
$('#name, #subject, #phone, #comments, #website, #verify, #email').triggerHandler("focusout");
if ($('#contact mark.error').size()>0) {
if(shake == "Yes") {
$('#contact').effect('shake', { times:2 }, 75, function(){
$('#contact input.error:first, #contact textarea.error:first').focus();
});
} else $('#contact input.error:first, #contact textarea.error:first').focus();
return false;
}
});
});
$('#contactform').submit(function(){
if ($('#contact mark.error').size()>0) {
if(shake == "Yes") {
$('#contact').effect('shake', { times:2 }, 75);
}
return false;
}
var action = $(this).attr('action');
$('#submit')
.after('<img src="assets/ajax-loader.gif" class="loader" />')
.attr('disabled','disabled');
$.post(action, {
name: $('#name').val(),
email: $('#email').val(),
phone: $('#phone').val(),
website: $('#website').val(),
subject: $('#subject').val(),
comments: $('#comments').val(),
verify: $('#verify').val()
},
function(data){
$('#message').html( data );
$('#message').slideDown();
$('#contactform img.loader').fadeOut('slow',function(){$(this).remove()});
$('#contactform #submit').attr('disabled','');
if(data.match('success') != null) $('#contactform').slideUp('slow');
}
);
return false;
});
Upvotes: 2
Views: 310
Reputation: 32066
Your code disables the submit button and only re-enables it if the post is successful.
Upvotes: 1