Score:1

Adding an "Accept Terms" checkbox on User Registration form

in flag

I need to add an "Accept terms and conditions" checkbox onto a user registration form. What is the best way to do this?

Also, it seems odd to me that there is no easy way to use radio buttons nor checkboxes on the User Registration form at admin/config/people/accounts/fields. Select lists are awkward, especially for multi-select lists on a mobile device.

Is there a way to output the list fields as radio buttons and checkboxes?

leymannx avatar
ne flag
hook_form_alter from a custom module into the user registration form and add a `'#required' => TRUE` `'#type' => 'checkbox'` element.
Score:5
in flag

Just add a required boolean field on the User entity (like literally just add this via admin, no code needed). Position it in the Registration form display (see Manage Form Display), but hide it in the view display (i.e. Manage Display). You can use the field help text as fine print.

in flag
Thank you! Not sure why I didn't think of this.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.