I have a select list with some options. But now I also want an option Other. And when you select the Other option there has to open a pop-up screen with the add term to vocabulary form in it. The term should not be added directly to the vocabulary, it should be "disabled" first so the administrator can approve them.

I know how to get the taxonomy form (taxonomy_form_term, drupal_get_form, drupal_render_form) but I have some other questions:

  • How can I open the popup and show call the function in my module to render the form? Should I add another option to my select list?
  • How can I make sure when you add it, it doesn't add directly to the vocabulary (admin has to click approve)

1 Answer 1


For the first part of your question, set an event listener to bind when the other option is selected, and then display your popup. I would suggest setting a custom state (see the Form API) and listening for that state. The example given in the states API explains better:

Each remote condition is a key/value pair specifying conditions on the other element that need to be met to apply the state to the element:

  'visible' => array(
    ':input[name="remote_checkbox"]' => array('checked' => TRUE),   ), ) 

For example, to show a textfield only when a checkbox is checked:

 $form['toggle_me'] = array(   
   '#type' => 'checkbox',   
   '#title' => t('Tick this box to type'), 
 ); $form['settings'] = array(   
     '#type' => 'textfield',   
     '#states' => array(
     // Only show this field when the 'toggle_me' checkbox is enabled.
     'visible' => array(
       ':input[name="toggle_me"]' => array('checked' => TRUE),


jQuery UI Dialog would be a good solution for the popup.

For the second part, there is a module to handle just this situation, so that taxonomy terms can be moderated and approved. Taxonomy Other:

Use case example: You have a taxonomy vocabulary called 'Organization type' and you want to allow users to be able to choose '- Other -' and add their own type. You want to use a simple select list and to keep the list small to encourage people to use the types you've provided.

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.