[development] animation with Ajax Module
Blake Senftner
bsenftner at earthlink.net
Wed Dec 8 21:17:01 UTC 2010
Having recently started using the Ajax module, the way that I understand one gets such 'busy...' or 'something is happening...' animations is to do it yourself via something like:
1) logic that starts the asynchronous action puts an animating gif over the element(s) that will change. (Animation is spinning image designating 'action'.)
2) logic that ends the asynchronous action removes from the user's visibility the animating gif at the same time as revealing the newly changed element(s)
Note that the gif handling aspect of this logic is better performed at the javascript level, and with something like JQuery. However, now that I'm happy with handling this via JQuery, I'm looking at the Ajax module and thinking "and what exactly are you for?"
The Ajax module does not appear to handle updating UI elements that have their state changed by the asynchronous form submission, and on top of that the Ajax module appears to have changed the use pattern of the form/form_validate/form_submit callbacks. Without the Ajax module, the use pattern of the callbacks is to call the form callback once, and then repeated calls to form_validate until all UI elements pass validation, and then a single call to your form_submit callback. Under the Ajax module, the form callback is called after form_validate fails. This is minor, and probably caused by the Ajax module explicitly not caching the results from your form callback, whereas without the Ajax module your form callback results are probably cached - but the behavior is different and one should be aware of that.
Also, performing Ajax loads via JQuery is so easy that as soon as I finish writing this email, I'm going to disable the Ajax module and add the minor amount of code to handle my Ajax loads myself. (I also happen to be reading "JQuery: Novice to Ninja" at the moment, in the specific chapter that walks one through doing Ajax loads.)(I recommend the book.)
Sincerely,
-Blake
bsenftner at earthlink.net
www.BlakeSenftner.com
www.MissingUbercartManual.com
On Dec 8, 2010, at 8:56 AM, Don wrote:
> I'm using the Ajax module to submit a form in a block, Drupal 6.19.
> It works fine, but there's no animation displayed to indicate that something has happened. The only feedback is the status message it gets back.
> I've seen a clockface animation in some of the other forms, any way to get it to work here?
> Any ideas before I strike out on my own?
>
> Thanks.
> -Don-
>
More information about the development
mailing list