AJAX form for node subscribe links
| Project: | Subscriptions |
| Version: | 5.x-2.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hi Salvis,
I think the best solution would be to write some custom jQuery code to do the ahah transaction, but here is a very simple approach using ActiveEdit (JStools module http://drupal.org/project/jstools).
Advantages:
- very easy to implement - piggy-backs on all the good work in ActiveEdit
- uses existing perms (edit via ajax + subscribe to content).
- non-JS graceful degradation - simply re-loads page with normal subscriptions form appended.
- distributed with JStools - the attached subscriptions.inc file would be submitted as a patch to JStools (install instructions in comments).
Disadvantages:
- ActiveEdit is actually a suite of functionality rather than an API (not super light-weight)
- To enable the active edit subscribe, you need to permit active edit on all links & fields.
- ActiveEdit requires the FormFilter module http://drupal.org/project/formfilter, which is not used at all for this particular application.
For my purpose, these are not deal breakers - I can use the rest of ActiveEdit functionality. But I can see that it is not the ideal long term solution.
Anyhow - if you're interested, give it a whirl. If you think this is a reasonable direction to proceed, I'm willing to create a patch for submission to JStools, and then maybe I could provide a little documentation in the handbook or something?
(sorry this isn't submitted as a patch - I'm not setup for CVS access... yet)
| Attachment | Size |
|---|---|
| activeedit-subscriptions.zip | 998 bytes |

#1
Thank you for your post, jfall!
This is an amazing trick and works surprisingly well. It does break the Subscribe form's JS, though, and also somewhat the Garland theme (the table is too wide).
But, as you point out, the dependencies are heavy, and for D6, the upcoming Activeedit module adds a dependency to the Popups module in addition to the Formfilter module (no D6 version in sight). Also, giving the edit via ajax permission to all authorized users would cause a considerable performance hit (if I understand this correctly, Activeedit retrieves the settings forms for the site name, logo, etc. for each page, to figure out whether those elements are editable by the current user).
It works nicely for those who are willing to pay the cost, but I don't think I can recommend it as THE solution for everyone.
#2
Yeah, I noticed that it breaks a few things. I just tried it in IE, and it is unworkable with my theme. But its a decent proof of concept.
When I get some time I'll revisit this and see if I can yank out the logic to just handle the subscription form. I've been meaning to learn a little more about AJAX, so I ordered a book and this'll be my first project...
thanks for your help salvis.