Hi,

when i add a new term and click on "save" it takes some time before the new term is added. During this time no "loading screen" or something is showing. How can i implement this? I need this because users press and press the save bottom cause they think nothing is going on (this adds the same term 100x into my vocubulary :-/)

kind regards,
lolhonk

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

igorski’s picture

Please try the attached patch file. I’ve added a simple progress indicator to shs.js.
The inline CSS is definitely bad style, but it’s a start.

igorski’s picture

FileSize
2.13 KB

A slightly better version which accounts for RTL themes.

vgutekunst’s picture

Thanks i will test it! ;-)

vgutekunst’s picture

hi thanks for this patch! It worked! The loading button now floats to the right. Is it possible to get him directly under or beneath the new field? Because i think the user dont see it when its in the left or right corner of the screen

Nikita Petrov’s picture

#1 works great! Thank you, igorski.

rooby’s picture

Title: No loading process showing » Add a throbber to show the user when terms are loading via ajax
Assigned: vgutekunst » Unassigned
Category: Bug report » Feature request
Status: Active » Needs review

This patch is definitely an improvement.

As mentioned in #4 it would be nice if the throbber was directly to the right of the field instead of all the way to the right of the screen, but it is still very usable in its current state.

ParisLiakos’s picture

i find it easier to notice when there is no float at all..
float right means that in the standard drupal node form and a big screen, you never notice the throbber :)
here is a patch with the float removed. The widget jumps now a bit, but imo at least it is noticeable now

ron_s’s picture

A throbber is displayed by default using this patch to dispatch a change event:
https://www.drupal.org/node/2264795

Might want to check this one first, since the change event is needed to support other modules and States API.

ParisLiakos’s picture

I applied the patch there, but there was no throbber after changing a select element

ron_s’s picture

That's odd, I did get one. Possible that something in the css is causing it to not display?

ParisLiakos’s picture

no, i dont see one even in the html source code..maybe another module you have installed?
i dont see how would a loader would be triggered though tbh just by a change event..
i think #states in Drupal7 have nothing to do with ajax, they are just plain jQuery commands that act on html thats already there

ron_s’s picture

Yes, could be that the form is already wrapped in an ['#ajax'] that's causing it, I haven't tested.

So I'm assuming if the same was done to the SHS field in a hook_form_alter, it would cause a throbber to appear:

  $form['field_my_shs_select'][LANGUAGE_NONE]['#ajax'] = array(
    'callback' => '',  // can add one if you'd like, but not necessary if no other action
    'event' => 'change',
    'progress' => array(
      'type' => 'throbber',
      'message' => NULL,
    ),
  );

Should also mention that the event can be 'click' rather than 'change' too. I believe there are several possible options.

fullerja’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #7 works for me.