I'm using jquery-steps.js ,
I want to disable submit button when some one click on submit, and never activate it until the the form is submitted.
The reason way is that if some one click on submit many time the I receive many mails!
Note : my HTML file does not include submit button , it is only show from the js file that I include bellow
and my js file look like this.
$(function() {
$("#smart-form").steps( {
bodyTag:"fieldset", headerTag:"h2", bodyTag:"fieldset", transitionEffect:"slideLeft", titleTemplate:"<span class='number'>#index#</span> #title#", labels: {
finish: "Send søknad", next: "Neste", previous: "Tilbake", loading: "Laster..."
}
, onStepChanging:function(event, currentIndex, newIndex) {
if(currentIndex>newIndex) {
return true;
}
var form=$(this);
if(currentIndex<newIndex) {}
return form.valid();
}
, onStepChanged:function(event, currentIndex, priorIndex) {}
, onFinishing:function(event, currentIndex) {
var form=$(this);
form.validate().settings.ignore=":disabled";
return form.valid();
}
, onFinished:function(event, currentIndex) {
var form=$(this);
$(form).ajaxSubmit( {
target:'.result', beforeSubmit:function() {}
, error:function() {}
, success:function() {
$('.alert-success').show().delay(7000).fadeOut();
$('.field').removeClass("state-error, state-success");
if($('.alert-error').length==0) {
$('#smart-form').resetForm();
reloadCaptcha();
}
}
}
);
}
}