50 terms and each term needs to have radiobuttons or "other".

Food - o in price - o extra price

Drinks - o in price - o extra price

WiFi - o in price - o extra price

So "in price" and "extra price" are radiobuttons. User clicks "extra price" and he gets conditional text field (integer) where he can write the extra price. Result after choosing "extra price" should look like this:

Food - o in price - o extra price - _________ €.

There are 2 things that come to my mind. Making separate vocabulary out of each term, each containing terms "in price" and "extra price", make separate integer field in content type and use conditional field module.

But that would mean i would have to create 50 vocabularies and 50 integer fields for 1 content type and its possible that there will be more terms in the future.

2nd option would be creating 50 fields instead of using taxonomy and use Select or other module but that also seems to be overdoing it to have 1 content type with over 50 fields just becouse of this option

  • is drupal_add_js('...',inline) and handle displaying the radios by adding / removing a class with 'display:none' an option?
    – Joel Box
    Jul 24, 2015 at 14:09
  • Unfortunately i only know how to use modules.
    – Azz Kawa
    Jul 25, 2015 at 9:25

1 Answer 1


With a module, creating a form and using the drupal ajax function to switch the input field on/off might be a solution.

check out this example from deckfifty: form api using ajax example

partial code:

function deckfifty_example_form($form, &$form_state) {
  $form['fox_color'] = array(
    '#title' => t('Specify the color of the fox:'),
    '#type' => 'select',
    '#options' => drupal_map_assoc(array('', 'brown', 'black', 'white')),
    '#ajax' => array(
     'callback' => 'deckfifty_fox_ajax_callback',
     'wrapper' => 'deckfifty_fox_ajax_wrapper',
 $form['fox_wrapper'] = array(
    '#type' => 'markup',
     '#prefix' => '<div id="deckfifty_fox_ajax_wrapper">',
    '#suffix' => '</div>',

 $form['submit'] = array(
   '#type' => 'submit',
   '#value' => t('Save'),

 return $form;
  • Link is not working, get 404 error. But anyway i do not have any skills in creating modules.
    – Azz Kawa
    Jul 27, 2015 at 17:19

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.