3

I need to add a boolean attribute in the form of a check-box to a ordinary multivalued text field attached to a node. In this case, the text field will be used to list arguments for functions, which can either be required or not-required. So, in a node-edit form, I envision it to look something like the screen below. What's the best way to go about this?

text field with attribute

Edit: adding links to suggested options, and also some that I found while checking these out:

  1. field collection - https://drupal.org/project/field_collection
  2. field collection table - https://drupal.org/project/field_collection_table
  3. double field - https://drupal.org/project/double_field
  4. tablefield - https://drupal.org/project/tablefield
  5. multifield - https://drupal.org/project/multifield (dev)

2 Answers 2

3

You can write your own field type and widget form. A good example can be either filefield or imagefield.

Or try Field collection module.

So you can create a new type of field in field_collection UI.

Here are tutorials: https://drupal.org/node/1353926

2

Field Collection module is what you looking for. OR, if you don't want to use field collection module for any reason, you want to make your own field type. You can follow this tutorial from Phase2 and suit it to your needs:

http://www.phase2technology.com/blog/compound-fields-in-drupal-7/

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.