mirror of
https://github.com/e107inc/e107.git
synced 2025-04-19 20:21:51 +02:00
Display loading button on form submit only when submit is successful. (no validation issues)
This commit is contained in:
parent
9629bd4510
commit
b762c10ecc
@ -745,22 +745,31 @@ $(document).ready(function()
|
||||
|
||||
$('button[type=submit]').on('click', function()
|
||||
{
|
||||
var caption = $(this).text();
|
||||
var caption = $(this).text();
|
||||
var type = $(this).attr('data-loading-icon');
|
||||
var formid = $(this).closest('form').attr('id');
|
||||
var but = $(this);
|
||||
|
||||
if(type === undefined)
|
||||
if(type === undefined || (formid === undefined))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
caption = "<i class='fa fa-spin " + type + " fa-fw'></i><span>" + caption + "</span>";
|
||||
$('#'+formid).submit(function(){ // only animate on successful submission.
|
||||
|
||||
caption = "<i class='fa fa-spin " + type + " fa-fw'></i><span>" + caption + "</span>";
|
||||
|
||||
$(but).html(caption);
|
||||
|
||||
if( $(but).attr('data-disable') == 'true')
|
||||
{
|
||||
|
||||
$(but).addClass('disabled');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(this).html(caption);
|
||||
|
||||
if($(this).attr('data-disable') == 'true')
|
||||
{
|
||||
$(this).addClass('disabled');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user