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

iamjon’s picture

I'm also curious if there a way to do this via the api?

iamjon’s picture

This 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('

Only local images are allowed.

');
}
//show loader
else $("#somediv").show();

return true;
}
//if there are error messages
if (hook == 'message') {
//hide loader
$("#somediv").hide();
$("#edit-submit").show();
return true;
}

};