[development] javascript ids of cck fields

fago nuppla at zites.net
Fri Sep 29 16:46:20 UTC 2006


I have just written a small module "form_enabler", which
enables/disables form fields in dependency of a checkbox.
http://drupal.org/project/form_enabler

I integrated this with the CCK, however I need the javascript ids of all
target fields (= fields that depend of a checkbox). I couldn't find a
simple way to get these IDs.

So I wrote a function (form_enabler_form_get_ids()), which works similar
like form_builder(). It builds all #parents, processes the form
(#process), sets the #id like form_builder() would do and returns an
array of ids for me. This is called during hook_form_alter().

This does already work, but the actual question I have is:
Can this be done easier? Have I missed anything?

-fago



More information about the development mailing list