Usercase: Have a list with services for shops. Those services can be done with an appointment, or without. So the services are checkboxes, and the radio needs to show if it can be done with or without an appointment.

I am scratching my head over this, tried some modules like double_field and composed_field, but they do not fit this case it seems. End-users must be able to choose the services they sell, and also verify if they sell this with or without an appointment.

Example-sketch: mockup

  • JS? otherwise have a look here. drupal.stackexchange.com/questions/159853/…
    – GwenM
    Jun 13, 2015 at 9:05
  • I would really like to create a field that can be used on other forms too, without form alter, I do not think I need js for that.
    – Marcel
    Jun 15, 2015 at 6:07
  • Dude, services are multiple, so you are providing checkboxes for each one to select. Now if you want to provide another attached field to it called appointment, then why are you providing radio buttons for it ? Do you want to have appointment for only one service ? you should make them checkboxes too. Do you agree ? Jun 15, 2015 at 7:25
  • @Himanshu: Maybe checkboxes with checkboxes is the way to go. Rephrase: Each service needs another boolean field next to it.
    – Marcel
    Jun 15, 2015 at 7:27
  • @KrishnaMohan: double field can only provide 1 radio/checkbox for the whole list instead of each item. Or maybe did I miss something there, but I checked and tried multiple times. If you show me in an answer how you achieved it with doublefield and it works I'd gladly accept it as the right answer.
    – Marcel
    Jun 15, 2015 at 7:28

4 Answers 4


You can also achieve that using the Double Field module.

Go to your content type and add field Type as Dobule field and Wideget as checkbox and checkbox

You can add Prefix or suffix for each field to display them as label for them.

Additionally you can use the Field Group module to make them under a roof.

Here is the screenshot:

enter image description here

  • Thank you I fiddled around with this but this doesn't support a list as the first field, it only supports 1 value per created doublefield. The first field must be a list (displayed as checkboxes.
    – Marcel
    Jun 18, 2015 at 6:37

Conditional Fields

Another approach to consider, is to use the Conditional Fields module ... Here is an excerpt from its project page:

... allows you to manage sets of dependencies between fields. When a field is “dependent”, it will only be available for editing and displayed if the state of the “dependee” field matches the right condition.

When editing a node (or any other entity type that supports fields, like users and categories), the dependent fields are dynamically modified with the States API.

Refer to the Community Documentation for this module for a lot more information about this module.

Note: this module still has an Alfa status (only), but over 38K sites using it already. Therefor I believe "alfa" is not the right label (anymore)à for this release. It should be at least an RC-version ... if not just an official release ...

Field Group

Maybe you want to consider the Field Group also, to create 3 'groups' (1 for each of the 3 services). Excerpt from its project page:

Fieldgroup will group fields together. All fieldable entities will have the possibility to add groups to wrap their fields together. Fieldgroup comes with default HTML wrappers like vertical tabs, horizontal tabs, accordions, fieldsets or div wrappers.


To actually query these combined fields, you can create an appropriate view in a tabular display format that uses the DataTables module, which uses the datatables plugin.

Here are a few online samples to see that module at work (a rather basic views display, using the dataTables views style):

  • AbitMORE-scm.com: experiment with the search box in the upper right, eg first type "without" in it, see what happens, and then continue typing so that it becomes "without packages". Doing so you'll only get the rows displayed that contain both keywords somewhere in any of the columns (= 'and' operation), in this sample "without" in 1st column and "packages" in 2nd column.
  • Dr.Chgman.com: similar suggestion for the search box, like "zmf z- 1.2" (pause a few secs before typing the spaces in between).
  • In both options the fields aren't linked together as they should. I need both values together to query them in a view (e.g. display all services on a page that can be done without an appointment)
    – Marcel
    Jun 18, 2015 at 7:11
  • I just extended my answer to also include aa solution for the query you described in your recent comment ... Jun 18, 2015 at 7:50
  • Did you have a chance to experiment with the Datatables modules? E.g. using either of the links of the online samples I mentioned? Aug 26, 2015 at 16:53

Writing your own module can solve your problem too .

for that you need to create your own field which contains 2 values. first you have to introduce your field to drupal , use hook_field_info() for that .

function ModuleName_field_info() {
   return array(
      'ModuleName_services' => array( //your sub-Field machine readable name.
          'lable' => t('Services'), //Human readable name
          'description' => 'some description', //optional
          'default_widget' => 'widget_name', //optional (text_textfield works here)
          'default_formatter' => 'formatter_name', //(text_default is fine)
      'ModuleName_appointment' => array(
         'lable' => t('Appointment Status'),
         'description' => 'some description',
         'default_widget' => 'widget_name',
         'default_formatter' => 'formatter_name',

then Implement hook_field_schema($fields) to specify a place in database . other options could find here and here

function ModuleName_field_schema($fields) {
 columns = array (
  'service' => array(
    'type' => 'varchar',
    //other options could find [here][2] and [here][3]
    'not null' => true,
   'appointment' => array(
     'type' => 'int',
     'size' => 'tiny',
     //More options if you wish
  $indexes => array('services');
 return array($columns , $indexes);

if you want more customization you can define your own field_widget and your own field_formatter too . more on that you can also assign some field settings which can be modified in future using Field UI.

  • Sorry, I have not enough knowledge to estimate the value of this answer. I am fiddling around with the code but accomplish nothing.
    – Marcel
    Jun 18, 2015 at 7:34
  • using hook_field_info we tell drupal about our field type . we return an array , containing 2 values (one for storing service name and second for storing its appointment status) . widget is what used to collect data (for example popup calendar is a widget to collect date info) . formatter is what used to present field data (like tumble image format) . first block is written in .module file usually . second code block is written in .install file , so when you are enabling your module it will create a table based on your columns and your data will be stored there. Hope this would help . Jun 18, 2015 at 8:28

I would suggest you to use the Field Collection module in this scenario. You have to add a field_collection type field in your entity(node) and make its cardinality "unlimited". Now follow these steps:

  1. Go to manage field section of the field_collection item you've just added.
  2. Add services field and make it checkboxes/drop-down whichever you like, you can add options for the checkboxes there. But I would suggest to make services a taxonomy vocabulary and attach them through term_reference field type here.
  3. Add a boolean checkbox field for appointment.

That should work.

  • Thank you. This has the same problem as the double_field. It only provides one checkbox for the entire list of services. I need an appointment checkbox per service.
    – Marcel
    Jun 18, 2015 at 6:49

Your Answer

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

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