1

Is it possible to add multi-choice checkbox fields to a Content Type or the fields of a User Type? Hoping it is possible to create the following when a User is registering for an account. They should be able to choose multiple check boxes when registering.

Desired output in user registration form:

<input type="checkbox" id="checkbox1" name="checkbox1" value="first-choice">
<label id="checkbox1-label" for="checkbox1">First Choice</label><br>

<input type="checkbox" id="checkbox2" name="checkbox2" value="second-choice">
<label id="checkbox2-label" for="checkbox2">Second Choice</label><br>

<input type="checkbox" id="checkbox3" name="checkbox3" value="third-choice">
<label id="checkbox3-label" for="checkbox3">Thrid Choice</label><br>
5
  • Yes this is possible. The user entity is fieldable.
    – leymannx
    Commented Jul 21, 2019 at 20:21
  • Do I need to use PHP? Or can it be done by managing fields within the admin interface? What field would I use?
    – crayden
    Commented Jul 21, 2019 at 20:23
  • Yes, admin interface. Use a List field.
    – leymannx
    Commented Jul 21, 2019 at 20:54
  • @crayden which version of drupal are you using? 7 or 8? Commented Jul 24, 2019 at 15:51
  • I am using Drupal 8
    – crayden
    Commented Jul 24, 2019 at 15:51

1 Answer 1

2

You can add checkbox list from Account Settings

Go to Configuration >> People >> Account settings - http://example.com/admin/config/people/accounts/fields

Add Field >> Add a new field of List(text)

enter image description here

Add options and select options as unlimited (for multiple select)

enter image description here

Save and go to Manage Form display (/admin/config/people/accounts/form-display) change the checkbox widget to checkboxes/radio buttons.

enter image description here

That's it you can see the check boxes in user account form like this

enter image description here

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