### Documentation

# Custom fields basics

TotalPoll allows you to have additional fields under poll questions in order to collect information such email, name and other from end user.

### Available custom fields#

Custom field types

- Text: Simple text field.
- Textarea: Text field with multiple lines.
- Select: A dropdown menu.
- Checkbox: Choices with multiple selection.
- Radio: Choices with one selection.

### Basic settings#

The basic settings are used to define field properties such name, label, default value, options and more.

Custom field basic settings

Name: The name of the field (i.e. email_address).

Heads up! This must be unique to avoid overlapping between fields.

Label: The title of the field (i.e. Email Address).

Default Value: The initial value of the field.

### Validation rules#

Validations rules are essential to avoid spam entries and collect only validated information. These are available validation rules in TotalPoll:

Custom field validation rules

Filled: The field must be filled (i.e. required).

Email: The field must contain a valid email address (i.e. [email protected]).

Unique: The field value must be unique in the database.

This is a good way to prevent duplication like entering an email address twice for example.

Filter by list: Allow or deny specific words where the input of the user should satisfy.

Filters are processed in the same order as defined.

Regular expression: The field value should satisfy a regular expression.

### HTML settings#

Usually, customizing plugin generated markup requires injecting some code but thanks to these settings, you're able to customize it directly from the interface.

Custom field HTML settings

Field CSS Classes: You can set CSS classes of the input element (i.e. `email-field form-control`).

Label CSS Classes: You can set CSS classes of the label (i.e. `email-label form-control-label`).

Template: You can use {{label}}, {{errors}} and {{field}} variables for customzing the template. Useful for markup customization (i.e. `<div class="form-group">{{label}}{{field}}{{errors}}</div>`).