Textfield

Purpose and Properties

In most situations, text boxes are the most important controls of data entry screens. Primarily, they are used to enter free text, but you can assign comprehensive formatting and validation options, if required. This allows you to use text boxes to prepare data entry screens for the input of the most diverse data. A special case is the so-called [number servers]( “number servers”) which automatically populates a text box, based on a predefined schema.

Docusnap-Edit-Text-Field

The table below list the specific properties of text boxes, including a brief explanation:

Specific Properties of Text Box Controls
AcceptsTabSpecifies whether the tab key can be used as an input character or not.
CharacterCasingDefines whether the text entered by a user will be shown in uppercase, lowercase or normal characters.
FieldnameSpecifies the linked column in the respective table of the current Docusnap database. The meta object linked with the data entry screen determines which table will be used. Unlike most other controls, text boxes can be linked with nearly every data type that exists in the database. Make sure to specify an appropriate data validation, otherwise errors may arise when users enter data of the wrong type.
MultilineDetermines whether a text box should consist of one single line or multiple lines. It is neither possible to enter line breaks into single-line text boxes nor can the height of these text boxes be changed. Multi-line text boxes are recommended for the input of large amounts of information. Care should be taken to ensure that the corresponding database field is large enough to accommodate the data (use the varchar(1500), TEXT or MEMO type).
PasswordIf you set this property to ‘True’, each character entered by a user will be displayed as an asterisk (*). In addition, a button will appear in the text box. When a user clicks this button, the content of the text box is displayed as plain text.
ReadOnlyUsing this property, you can specify whether the text box will be used for data input and output or merely for the display of database data. If you set this property to ‘True’, users will not be able to change the data in the linked database column. This property is always useful if the data shown in the text box are predefined and should not be changed. However, please note that there must always be another way to save the data in the database, for example, by means of a script or an inventory process. One use case for this property would be when using the number server, because the content of the text box is generated automatically and users should be prevented from changing it.
ScrollbarsDetermines if scroll bars will be displayed in multi-line text boxes and if so, which type. In principle, navigation within a text box control is also possible without scroll bars by using the keyboard or the mouse. However, scroll bars significantly facilitate this process.
ShowCopyButtonSpecifies if a button will be displayed in the right part of the text box for copying its current content to the clipboard.
SystemInvisibleIf you set this property to ‘True’, the text box will not be displayed during the runtime of the data entry screen, but rather filled with a predefined value that you can determine by means of the DefaultValue property. This approach is useful when the database schema requires a static value that the user cannot enter, for example automatic input of the corresponding device type in data entry screens at the device level.
TextAlignDetermines how the characters will be aligned in the text box. As a rule of thumb, select left alignment for free text and right alignment for numbers (this improves their readability).
TypeConstraintDefines specific validation options for the content of a text box. For details on these options, see the subsection below and the dedicated number servers section.

TypeConstraint Property

This property can be used to store specific validation options for the input of data in a certain text box. If the validation results in errors when a user tries to save a record of data entered into the respective data entry screen, the save will be aborted and a predefined error message will display. Several predefined validation types are available that are briefly explained in the table below.

Content TypeDescription
TextWhen you select the Text content type, users can enter free text into the text box that might be checked further before they are saved.
- Normal Text: Users can enter any text. It will not be validated.
- IP-Adresse: Verifies if the text entered by the user is a valid IP address.
- Subnetz-Maske: Verifies if the text entered by the user is a valid subnet mask.
- MAC-Adresse: Verifies if the text entered by the user is a valid MAC address. The character groups may be separated either by no character at all or by colons (:) or hyphens (-).
- Directory: Verifies if the text entered by the user is a valid directory path. If you also enable the Directory has to exist checkbox, Docusnap will check whether the specified directory really exists on the hard disk or share.
- Drive Letter: Verifies if the user entered a valid drive letter. Please note that Docusnap will not check whether the drive really exists and is connected.
GanzzahlSpecifies that this text box is reserved for entering integers. For number values, you can also specify a factor in the Factor field so that the integer entered by the user will be multiplied or divided by this value. The database will store the product of this multiplication. In this case, it is recommended to add the factor to the corresponding column in the meta table to obtain a consistent representation of the numbers in the data entry screen and the associated lists.
ByteSpecifies that this text box is reserved for entering byte values.
MemoSpecifies that this text box is reserved for entering text in the MEMO format.
DezimalzahlSpecifies that this text box is reserved for entering decimal numbers. As with integers, you can specify a factor.
GUIDSpecifies that this text box is reserved for entering GUID values.
VersionSpecifies that the text entered in this text box must have the format of a version. For example: 7.0.219.4

In addition to the predefined types, you can define and apply your own validation rules. When defining such rules in Docusnap, you can use regular expressions (RegEx), which allow the definition of almost any validation check. Introductory information about regular expressions can be found on many websites, such as Microsoft’s http://msdn.microsoft.com/en-en/library/az24scfc.aspx or Wikipedia http://en.wikipedia.org/wiki/Regex. To test and optimize regular expressions, we recommend the Expresso software from Ultrapico available under http://www.ultrapico.com/Expresso.htm.

Docusnap-Edit-Settings-for-Content-of-Toolbox

Number servers are a special case of text box. For more details, see the Number Server section.

Examples of Regular Expressions

Use regular expressions to validate the input in a text box. The text entered by a user is compared with a predefined pattern to make sure that the text is, for example, an e-mail address, a positive number, etc.

What do regular expressions consist of?

Enclose valid letters, digits and characters in square brackets []. The following characters can be used to define how often these letters, digits and characters should be repeated: ?,+ and *.

CharactersMeaning
[A-Za-z]This expression checks if a letter of the Latin alphabet has been entered at the indicated position.
[0-9]This expression is used to find any digit at a certain position in the input.
?The preceding letters, digits or characters are optional. They may (but need not) occur once, i.e. the expression occurs once or not at all.
+The preceding letters, digits or characters must appear at least once, but may occur repeatedly.
*The preceding letters, digits or characters may be repeated any number of times (or may not occur at all).
^Use the ^ character to identify the beginning of the pattern.
$The $ symbol is the counterpart of the ^. It indicates the end of the pattern that has to match the end of the string. In a regular expression, you can define multiple end characters, provided that the expressions are separated by a logical Or (|).
.Enter a period to check that any character (with the exception of a line break) exists at a certain position.
-Within character classes, a hyphen is interpreted as a character. There, it is used to specify character ranges.
\If you want to use a character in the pattern that has a specific meaning, such the period as a punctuation mark and not in its meaning as an expression for a given character, precede it with a backslash (\) to “escape” it.
()To group expressions, use parentheses.

Examples:

Check if a number is positive:
^[0-9]+((.[0-9]+$)|(.[0-9]+$)|$)

Check if the user input represents an e-mail address:
^[\w-.]+@([\w-]+.)+[\w-]+$