mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Display loading button on form submit only when submit is successful. (no validation issues)
This commit is contained in:
@@ -747,20 +747,29 @@ $(document).ready(function()
|
|||||||
{
|
{
|
||||||
var caption = $(this).text();
|
var caption = $(this).text();
|
||||||
var type = $(this).attr('data-loading-icon');
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#'+formid).submit(function(){ // only animate on successful submission.
|
||||||
|
|
||||||
caption = "<i class='fa fa-spin " + type + " fa-fw'></i><span>" + caption + "</span>";
|
caption = "<i class='fa fa-spin " + type + " fa-fw'></i><span>" + caption + "</span>";
|
||||||
|
|
||||||
$(this).html(caption);
|
$(but).html(caption);
|
||||||
|
|
||||||
if($(this).attr('data-disable') == 'true')
|
if( $(but).attr('data-disable') == 'true')
|
||||||
{
|
{
|
||||||
$(this).addClass('disabled');
|
|
||||||
|
$(but).addClass('disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user