I’m using the jQuery disable submit method to prevent double posts of my form data. BUT I also want the value of the submit button to be posted, which this method is preventing. Is there any way around this? Some of my forms have multiple submit buttons that determine how the post data is handled. Ideas?
$('form').submit(function(){
$(this).find('input[type="submit"]').attr('disabled',true);
});
EDIT:
This counting method has been recommended, but does not seem to work for blocking submits at all.
var i=0;
$('form').submit(function(){
//$(this).find('input[type="submit"]').attr('disabled',true);
i++;
if(i>1){return false;}
});
This might be mildly convoluted, but it seems to work. Create a hidden input on the fly that has the same name and value as the submit button you just clicked: