[support] Using AJAX to alter other forms on same page

Steve Edwards killshot91 at gmail.com
Fri May 18 21:55:54 UTC 2012


Is it possible to access other forms on the same page via an #ajax element?  I have a case where I need to have a Clear button on a form that not only clears out the form it's on, but also clears out checkboxes in other forms and clears data from ctools_object_cache.
The page is a custom search page created by the apachesolr module. In the sidebar I have multiple blocks that are just 'checkboxes' form elements of taxonomy terms (each block is a separate vocabulary). The checkboxes are used to select terms, which are written to ctools_object_cache using #ajax in the form when selected. What I need is to have a Clear button (or link) on the search form that does a few things:

Clears the search field
Deletes items from ctools_object_cache
Deselects the checkboxes in the sidebar forms
Selects a specific checkbox in another sidebar block (labeled "All")
Is it possible to do this using a #ajax button with Forms API? Or do I need to just write it as a separate Drupal behavior in jQuery? I know Drupal forms can be handled in jQuery, but from what I've seen, it's only for elements in the same form, not separate forms, even on the same page.

Thanks.

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120518/1bad02d6/attachment-0001.html 


More information about the support mailing list