Hi Folks.
I have a form which after value submission calls other API for data. Form submit is utilizing AJAX module.
Could you please advise how could I attaching any kind of progress indicator to submit action? So user is aware that something is going on.
I am not looking for quantifiable progress, just an indication that application is processing.
Ideally, i would like to put gif while submit process is in progress. If you could provide some guidelines where to start looking for it - would really appreciate.
Examples of those progress images can be found here: http://mentalized.net/activity-indicators/
Comments
Comment #1
iamjon commentedI'm also curious if there a way to do this via the api?
Comment #2
iamjon commentedThis is how I did it if there are better solutions I'll love to know:
In my js file
Drupal.Ajax.plugins.myjs= function (hook,args) {
//alert(hook);
if (hook == 'redirect') {
//load thank you
return true;
}
if (hook == 'submit') {
//hide submit button
$("#edit-submit").hide();
//check that progress indicator does not exist. if it doesn't:
//create loader
if(!$("#somediv").html()){
$("someform").append('
');
}
//show loader
else $("#somediv").show();
return true;
}
//if there are error messages
if (hook == 'message') {
//hide loader
$("#somediv").hide();
$("#edit-submit").show();
return true;
}
};