You use the text component when you want a patient or researcher to fill in free text, for example if you ask whether there are any remarks at the end of a questionnaire.
Setting up values:
On the tab “Specific properties” you have a few options. Firstly, the maximum length of the filled in text, the number of characters (including spaces). Next, the regular expression (also called regex). This is a string of characters that determines what kind of text needs to be placed, or what kind of text is invalid. For example, no special characters or a particular sequence of characters. A few examples:
Adjustable boundaries text field through “Regular Expression”
To set up the field in a way that for example only the letters and spaces can be filled in the field , can be done by copy pasting the codes below behind ‘Only letters and spaces’. This way ??????? (afgevangen)
Regular Expression codes:
- Only letters and spaces: ^[a-zA-Z\s]+$
- Only letters, numbers and spaces: ^[a-zA-Z0-9\s]+$
- Only numbers, a minus sign and a comma: ^-?([0-9]*\.?,?[0-9]+)$
- Letters and numbers but no spaces: ^[a-zA-Z0-9]+$
Attention: If the entering field does not satisfy the regex, a message about this will appear. For example, ‘The value filled in is invalid for this field. This field needs to satisfy the regular expression: ^[a-zA-Z0-9]+$.’ This can be very confusing for the person filling it in. If you want to show a simplified message, you can fill in your own validation message on the tab “Base properties”.
Do you want to add another restriction by means of regular expression, but you do not know how? Contact us so we can discuss the possibilities.
Allowing multiple lines
The following option on this tab is a check field with which you can indicate whether you want to allow multiple lines. It is standard for a text field to have the height of one line. If you check this option, the text field will become higher and within the field enter can be pressed to go to the next line. To be even more specific you can set up the desired height and width of the text field.
Entering example text (also called placeholders)
Finally, you can fill in a standard value. This is the text that will already be in the field. Here you type things such as “Type your text here” or “I am afraid of the dentist, because…”.