Documentation

Custom field advanced settings


Custom fields feature is one of the best TotalPoll features that allow you to collect more information from the voter. Each custom field type has specific set of settings to allow you customize it in the way you want.

Custom fields
Custom fields

Although the settings that will be shown to you vary according to the custom field type you are using. However, they are very similar and most of them are common.

Custom field options#

Whenever you add a custom field, you will have 3 sets of options categorized in 3 tabs

Custom fields options tabs
Custom fields options tabs

1. Basic#

Basic tab has options related to the field itself (i.e. name, label, options and default values).

Basic tab settings
Basic tab settings
  1. Label: The label of the field that will be shown to the user on front end, if you want the email address from the voter, your label can be Email address or Your email address.
  2. Name: This might be a bit confusing, but the name differ from the label, the name will be used to process the field value on back end, TotalPoll will fill the name for you, you don't have to change it as it will not be shown to the user.
    It is recommended not to use any special characters as part of the field name, TotalPoll will automatically strip or replace some of your field name characters on saving if it finds any character that is not suitable for a field name.
  3. Default value: If you want to have the field pre-filled with something, you can make use of the default value to do so.

If you are having a field that has multiple choices (i.e. checkbox, radio, select), you will have some more fields to fill

 

Basic tab for multiple value fields
Basic tab for multiple value fields
  1. Options: Applicable for fields that can have multiple values only, you will want to add the values you have. You can insert each value in a new line.
You should make sure you use the correct format when adding options (or values), you should always make sure the format in this way: option_key : Option Value where the former is the name of the option and the later is the option label that will be visible to the user
Example:

If you want 3 checkboxes (I like apple, I like banana and I like orange), you will have to enter the following:

apple_choice : I like apple
banana_choice : I like banana
orange_choice : I like orange

2. Validation#

You always want to make sure the values of your custom field you are receiving from the voters are valid ones. Here comes the validation tab to help you achieve that.

Custom fields validations tab
Custom fields validations tab
You may not see all the options in the figure above available, this is because some validation options are not suitable for some other custom fields. The ones in the figure are the text field validation options.
1. Filled (required)#

Will not allow the user to leave the field empty. If you enable it for selecting choices (i.e. checkbox, radio or select), the user will be required to select atleast one of the choices.

2. Email#

Forces the user to enter a valid email address format.

3. Unique#

The value inserted into the field should be used for the first time (nobody should have used this before). This is useful if you want to receive a unique value.

Example: You want voters to enter their phone number while voting, but you don't want to receive a phone number twice, the unique validation option is suitable for you to deny such entries.
4. Filter by list#
Filter by list validation
Filter by list validation

Filter by list is an easy way to validate the user input against a list, this is useful if you want to accept or deny specific terms or values.

Example: The figure above will accept any value starts with entry and deny everything else.
5. Regular Expressions#

If you are familiar with Regular Expressions, you can use this to validate the user input against a Regex pattern

Regular expressions validation
Regular expressions validation
  1. Expression: The regex pattern TotalPoll will validate against (you don't have to add delimiters as TotalPoll will do this automatically).
  2. Error message: Because this validation method is a bit generic, you will have to enter what the error will be when this validation fails.
  3. Comparison: You can specify when the field content is count valid:
    1. Must match: the user input is valid if the pattern matches
    2. Must not match: the user input is valid if the pattern does not match at all

3. HTML#

HTML tab has all the options related to the look of the field

HTML tab
HTML tab
1. Field CSS classes#

If you would like to add any custom CSS classes, you can add them here. You may add multiple classes and separate them with a whitespace.

2. Template#

You may want to wrap the field within some divs or display it somehow where it fits you more. TotalPoll gives you the ability to structure it the way you want. You can simply use the template variables available to structure it.

You can use some available preset templates (i.e. full column, 1/2 column.. etc), these are available presets for common use cases, you may use them by clicking the buttons available below the template text field.