Registration module

mikeker's picture

Following up from the BOF at DrupalCon SFO...

I have a client that asks me for occasional one-off work on their Drupal site. They needed a registration form. No problem: build a node type in CCK and off ya' go. Six months later, then needed a very similar registration form. OK, I don't want to create a nearly-identical content type, so I'll add new fields to the old form and use hook_form_alter to hide them when accessed from the old URL. Three months later, another registration form was needed -- mostly the same fields, but a couple of new ones. More hook_form_alter() tweaks... You get the idea.

It occurred to me that this is very much like registration forms for sports. In general, league forms have all the same fields, but occasionally there's an extra field or two because it's a winter/summer/youth/adult/team/individual event. And you don't want to create new content type for each unique event. Along those lines I wrote a module I'm calling Registration -- perhaps it's not the best name, I'm open to suggestions.

The basic concept: limit the fields available on a given node entry/edit form based on a taxonomy term.

  • There is one master content type associated with the Registration module which contains ALL the possible fields you would use to create a registration
  • There is a vocabulary associated with the Registration module. Terms in this vocab can be used to create custom registration forms (one per term).
  • For each registration form, you select which fields you'd like to appear on that form
  • We can add additional options, though currently I only have enable/disable registration and specify the path to create this type of registration.
  • Node creation happens as if this were yet-another-content-type

Since these are nodes, they benefit from all the love that nodes usually get in Drupal: Views, Nodequeues, etc.

What do folks think of this concept? Did I reinvent the wheel? (I couldn't find anything else that did something similar...)

Since this is very preliminary, I didn't want to post it to So, you can download the current incarnation from my site.

Any and all feedback is appreciated.



Registration module

james_g's picture

The reasoning seems sound to me and I'm not able to find any instance where this is duplicating existing functionality.
An alternative method that might achieve the same result would be to use the conditional fields module ( to set up dependencies for your fields to a 'controlling field' that you pre-populate via a hook_form_alter (Dependent fields from CTools might work for this also).
As far as this module is concerned, I would only suggest that you abstract it outside of the realm of Sports Management to make it more widely accessible for other uses. A non-sports example where this module might be useful is in creating product reviews. Different types of products could warrant the inclusion of CCK fields not pertinent to the others, such as towing capacity of trucks that would not be relevant to passenger cars.
A name along the lines of 'Taxonomy-based Form Template' (I know.. it's ugly) could be useful for this purpose.


mikeker's picture

I should look into conditional fields/CTools dependent fields -- combined with the prepopulate module and some hook_form_alter() to hide a taxonomy field.

I agree, this module is a more general solution than league registration and your example is perfect. To be honest, the biggest stumbling block for me has been figuring out a name that isn't a mile long! Custom Node Forms? I'm open to suggestions.


Perhaps some instructions...

mikeker's picture

I just realized that I didn't leave any instructions on how to use this module, in case anyone was going to try it out...

  • Download, un-tar and enable like any other module.
  • Go to admin/settings/registration. Select a content type to use as the master type and a taxonomy term to control the custom forms
  • Click "Create Custom Registration"
  • Fill out the form and click "Create New Registration Form"
  • Navigate to the path you enter in the Create Custom Registration form.
  • Voila!

Some notes:

  • The module creates a bunch of different permissions including being able to register for given events based on user role
  • Registrations can be enabled/disabled per-registration type
  • You can delete registrations, but there isn't a UI for this yet. Easiest way right now is to truncate the {registrations} and {registration_fields} tables. That will remove all custom registrations types, but not the nodes
  • There are no checks right now for whether you've removed a required field. Ideally, required fields in the master type would show up as checked and the user would have to uncheck them to remove them (say, if they were filling in that field through hook_form_alter or similar).


Module name

james_g's picture

I started trying to come up with a good name for the module and ended up with 'form inheritance'. That led me to finding this module which might be a good starting point: