I would like to add a select field like a drop-down in the contact form to let user select the reason why they contact (contact, customer support, etc.)

Based on this (excellent) answer Adding check boxes to contact form, i’ve managed to create a field with check box :

source : Adding check boxes to contact form

How can i do that with a select ?

Solution :

You can choose in the "manage form display". The column "widget" allow to choose "Select list" (see screenshot)

enter image description here

2 Answers 2


The question you referenced explicitly changes it from Select list (Which is the default for list fields) to checkboxes. All you need to do is skip that last step and keep it on Select List, then you have your Select.

  • yes, i wasn’t able to choose when i create the field but i discover that you can switch in the "manage form display". The column "widget" allow to choose "Select list" (see screenshot in my edited question) Commented Feb 21, 2017 at 10:14

There is a select form element that you can add to your buildForm or hook override, depending on how you are building your form:

$form['example_select'] = [
  '#type' => 'select',
  '#title' => $this->t('Select element'),
  '#options' => [
    '1' => $this->t('Contact'),
    '2' => $this->t('Other'),
    '3' => $this->t('Customer Support'),

This is from the Drupal documentation: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Element!Select.php/class/Select/8.2.x.

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.