[development] Creating fields: custom vs. CCK

Sean Wingert seanw at norris-stevens.com
Mon Mar 31 19:16:28 UTC 2008


With 20 different fields, it's difficult for users to input all 20 fields in one form. I want to separate the input into multiple tabs (MENU_LOCAL_TASK), each requesting a maximum of 5 fields of input. Unlike a multi-step / wizard-style form however, the data can be input in any order and not all fields are required, so the tabs (hopefully) help with data input and navigation. However, this creates problems: (1) need for multiple forms, (2) each form touches (validating, INSERT, UPDATE) different fields.

It seems that CCK does *not* require programming for the addition / deletion of fields, but the validation (e.g. regexp) of those fields *does* requires programming (via a PHP filter or a .module). Is that correct?

>> "I would start by looking at CCK and see if it will meet your needs."
  With CCK in my scenario, creating fields still requires validation (thus programming?), and while validation can be done via a PHP filter, an admin who accidentally deletes a field deletes the corresponding validation, whereas in a .module, the same admin would not have deleted the validation.

>>"Another approach I have used where I need more than custom validation is
to use a module to provide the skeleton for a new content type (title,
body plus and "special" fields I care about) and include any special
logic I might need and then use CCK to add additional fields as needed."
  I like this, but for validation, it seems like I'll need to write a .module to access (e.g. INSERT, UPDATE) the CCK field names (field_something) from the content_type table(s).

>>"If you just need additional validation you can write a module that implement
hook_nodeapi and adds validation to a content type created with CCK."
  This seems like a hybrid of CCK with a .module, which also seems(?) expensive, since drupal fires it off whenever it sees *any* node type? ("The nodeapi () hook is usually called by the node.module just after the node type-specific callback is invoked." VanDyk and Westgate).

What do you think?

Sean


More information about the development mailing list