7

I'd like to create a content type "Enterprise" where user can define N services and, for every service, N tasks. I have already created the other fields for this content-type (name, description, ..., easy fields) but I don't know how to start with the services and tasks.

I'd like to be able to create services and tasks in the same form. What would be the best way to do it?

3
  • 1
    Not really following what you need, are you looking for something like: drupal.org/project/hierarchical_select?
    – WestieUK
    Commented Apr 7, 2011 at 10:06
  • What data does a service contain? What data does a task contain? Are you writing a module? Or looking to "click it"? You're not giving enough info for useful advice, and I don't want to give you a solution that's potentially completely wrong. Commented Apr 7, 2011 at 12:20
  • Westie, hierarchical_select module is based on taxonomy. I would like to read values from other content-types; user should be able to create his own values for this content-types. These content-types would have a hierarchical structure (2 levels) inside the parent content-type (Enterprise). Bojan, a service could be "Car reparation" and tasks the actions that this enterprise can do in this field (things that can repair). Another service could be "Cleaning"; the tasks for this service could be "complete cleaning of your vehicle", "Wheels cleaning",...
    – user709
    Commented Apr 7, 2011 at 15:39

2 Answers 2

5

In case of use d6, you can use Flexifield, then after you install you should create a content type that should represent your subfields, and in your main content type you should create a new field, with Flexifield type, and then, define the it's a number of values of the field, and then, in the creation node form of your main content type, you`ll have a field (kind of group), that will have multiple subfields, and depending of the number of fields defined, you should have multiple "groups of subfields".

1

In drupal 6.x this used to be accomplished by using cck-3.x which had support for multi-group which is the behavior you're asking for.

In drupal 7.x this can be accomplish by using the field_collection module (http://drupal.org/project/field_collection) - THis module also requires the entity module.

Once you have that module set up the UI is a little different than jut adding a field and groups.

You're going to want to go to you "Enterprise" content type and add the new Field Collection field (right now the only display is hidden).

Once you added the field collection field :-). You will now need to go to field collection configuration screen over at admin/structure/field-collections. Here you control the fields within your collection.

So you should now see the new field_collection field you added, You will need to add the two new fields you want to that collection. In your case is the services and tasks fields.

Now you have a collection with two fields in it.

The weird thing is that in order to add collection right now you can't do it when creating the node. You will need to create the node and then you're provided with a "Add collections" link which allows you to add those "Services and Task".

Is a little wierd but it works. I'm sure in the future they're be more widgets available but for now thats whats available in drupal 7.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.