Automatic Form Fields

zwhalen - July 16, 2008 - 16:02

Here's what I'm looking for: CCK form fields (and/or fieldgroups) which generate automatically given some conditions.

For example, I create a new node, and am presented with a form field for each user in the database with a particular role.

So, let's say I have 15 users in my drupal site, the content type then presents me with 15 input text fields -- one associated with each user.

Is this something I can do within CCK?

You could do something like

nevets - July 16, 2008 - 16:20

You could do something like that for checkboxes/radioes/select using CCK but I do not think you can do that for text fields. That sounds more like a custom field type.

Checkboxes

zwhalen - July 16, 2008 - 16:43

Hmm, that might actually work, at least as a way into the problem.

If not, how would you recommend creating a custom field type. That is, would I have to build my own module, or is there someway to build my own form within an existing module?

PHP

zwhalen - July 16, 2008 - 17:38

Oh, OK. I see now on the form for creating a CCK field, you can enter PHP code to generate an array of values. That may be enough of a hook to get me what I need.

 
 

Drupal is a registered trademark of Dries Buytaert.