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.
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
Basic tab has options related to the field itself (i.e. name, label, options and default values).
- 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.
- 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.
- 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
- 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.
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
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.
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.
Forces the user to enter a valid email address format.
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.
4. Filter by list#
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.
entryand 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
- Expression: The regex pattern TotalPoll will validate against (you don't have to add delimiters as TotalPoll will do this automatically).
- Error message: Because this validation method is a bit generic, you will have to enter what the error will be when this validation fails.
- Comparison: You can specify when the field content is count valid:
- Must match: the user input is valid if the pattern matches
- Must not match: the user input is valid if the pattern does not match at all
HTML tab has all the options related to the look of the field
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.
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.