If you are using bootstrap use this
$('#ordersubmitform').submit(function(){
$('input[type=submit]').addClass("disabled");
});
I have an order form with a submit button:
{!! Form::open(['url' => action('\Modules\Ordering\Http\Controllers\CheckoutController@postSubmitOrder'), 'id' => 'ordersubmitform' ]) !!}
{!! Form::button('Place Your Order', ['class' => 'pull-right btn btn-success', 'onclick' => 'submit()']) !!}
on submit i want to disable the button so a user cannot click it twice or click it again causing a double or duplicate submission
$('#ordersubmitform').submit(function(){
$(this).find('input[type=submit]').prop('disabled', true);
});
would this be the appropriate direction to take? how could i replace the button with a loading image or an hourglass showing it has been submitted. and waiting for the redirect?
<input type="submit" value="Place Your Order" class="pull-right btn btn-success" name="submitBtn" onclick="this.disabled=true;this.form.submit();"
did the trick
Please or to participate in this conversation.