A single input question collects a single value for input types such as text, numbers, emails, telephone numbers, etc. By using its properties settings you can define the format and type of data the user can submit. For example if you want to only accept a date, you select the input type date, if you want to ensure the user submits a valid email address you use the input type email.
Common question types such as email, date, time are inbuild in the system, for question with specific format requirement you can define your own requirements, for example a question that records the ID numbers in the format "letter dash number number dash number". For this scenario you would use the question properties Input type and Input format, set the input type to be text and the input format a-99-9, this ensures only ID numbers with the defined format can be submitted. For more complex format requirements you can use regular expressions in the validators properties.
How to use the property settings for Input type, Input place holders, Input format, Input mask, unique and validation is explained in this section.
Input type
With the property input type you can set the type of data collected, check out the list below. For the input type text you can use the additional properties settings Input format, Input mask and validation to define your own input format rules.
- Color | Select a color from the color palette | |
- Date | Select the date from a date picker | |
- Datetime | Manual enter the date, use in combination with the input format for example input form yyyy/mm/dd | |
- Datetime-local | Select the date from a date picker and set the time | |
Input requires a valid email address, use in combination with input mask value set to email | ||
- Month | Select the month from a date picker | |
- Number | Input will only accept numbers | |
- Password | Password input (does not show the text) | |
- Range | Slider, set the value between 0 and 100 | |
- Tel | Use the input type tel in combination with the property Input mask value set to phone and a setting for the property input format. For example with the property input format set to +(999)-999-9999 the input field will accept tel numbers in the format +(361)-221-7710 | |
- Text | Input is a text question which can used as is or in combination with the properties Input format and Input mask, these properties will be discussed in the next sections | |
- Time | Select the time from the clock | |
- url | The URL of a website, this input field does not check for valid url values | |
- Week |
|
Input place holder
The input place holder puts a text in the input which will disappear as soon as the users enters an input value
Input format
For a input type text (and phone) you can set the required input format by using the following characters:
# | A hext decimal number is required |
a | A letter is required |
A | A capital letter is required |
9 | A number is required |
For a single input question with input type datetime and input mask datetime you can set the required input format for the date by using the following characters:
yyyy | Year format with 4 digits, for example 2012 |
yy | Year format with 2 digits, for example 12 |
dd | Day with 2 digits, for example 25 |
mm | Month with two digits, for example 01 is January |
Examples for the date format are: yyyy-mm-dd or dd-mm-yyyy.
Input mask
The input mask has a number of default input format settings that can be used with the text type question, these are:
- none | No input mask (default) |
- Datetime | Used in combination with the input type datetime and input format as explained under input format. |
- Currency | Will accept only numbers with two decimals, for example 1,201.55 |
- Decimal | Will accept decimal numbers |
Will accept a valid email address | |
- Phone | Use incombination with input format as explained under input format, for example +(33)-(06)-99-999-9999 |
- ip | Will accept valid a valid IP address |
Unique
Set the unique value to 1 to avoid uploading dublicate registration values. When this value is set to 1 you cannot upload registration values when there are dublicate values for this question.
Validation
With validators you can validate if the input submitted is correct and in the correct format. In this section we will discuss the use of regular expression validators which can be used to check if the input is in the correct format. Other validators options in the survey designer are relatively easy and straightforward to use.
A regular expression can be used to check if data submitted is in the correct format. Check the numerous resources on the internet that describe how to create your own regular expression. In this tutorial we will look at an example whereby the input has to have the following format:
2 or 3 characters followed by a dash followed by a 4 digit number followed by a dash followed by a 6 to 8 digit number
The regular expression for this is: ^[a-z,A-Z]{2,3}-\d{4}-\d{6,8}$
The regular expression ensures that only the required format is accepted