Fig. 1 - ValidationTextbox control
A control that allows the script user to enter text, which is validated against regular expressions (standard .NET variety ), either
The script can be prevented from continuing if an invalid entry is made.
This feature is required for any kind of user input that must conform to a specific set of criteria such as credit card numbers, email addresses, telephone numbers and also customised formats that may apply, such as customer account numbers and policy numbers.
Properties that are common to this and many other controls are described in Common Properties.
Property | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AcceptsReturn | See Text Entry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Background | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BorderBrush | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BorderThickness | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CompletionRegex | Select from the pre-defined regular expressions.![]()
This list is drawn from the file C:\Softdial\Scripter2\Designer\ScripterVisualStepTool.xml (on the Scripter Server), and can be adapted to suit your circumstances. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ErrorMessage | The message to be displayed when text is entered that does not match the CompletionRegex or PreviewRegex (whichever contains a valid regex). On selection of a CompletionRegex, a related default ErrorMessage is loaded. This can be edited to suit your circumstances. Text is validated as you type. When text does not match:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FontFamily | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FontSize | See Common Properties. Spacing between items is scaled automatically | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FontStyle | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FontWeight | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Foreground | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Height | See Common Properties. A vertical scrollbar is created and controlled automatically | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
HorizontalScrollBarVisibility | Ignored in this control. See the AcceptsReturn property in Text Entry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IsEnabled | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Language | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Margin | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Name | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PreviewRegex | Enter a valid custom regex expression against which the field is to be validated. May be used in conjunction with CompletionRegex. For error condition behaviour, see ErrorMessage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TabIndex | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Text | The text that the field will contain when the page is loaded. The user must overwrite this when entering text. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TextAlignment | Ignored in this control | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TextWrapping | See Text Entry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
VerticalScrollBarVisibility | Ignored in this control. See the AcceptsReturn property in Text Entry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Visibility | See Common Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Width | See Common Properties |
Fig. 2 shows the CardCapture screen from the Hotel demo script.
Fig. 2 - ValidationTextBox Control 1
The Card Number field is a ValidationTextBox control.
Notice the following three properties for this control:
The CompletionRegex field allows selection of a predefined set of regular expressions for the most common validation requirements (Fig. 3).
Fig. 3 - Validation Text Box 2
These regular expression definitions are stored in the ScripterVisualStepTool.xml file which can be found in the C:\Softdial\Scripter2\Designer folder. Below is an example of an entry in this file.
<regExpression>
<name>Credit Card number</name>
<description>Checks if it contains 16 numbers in groups of 4 separated by -, ,or nothing</description>
<matches>Matches 1111-2323-2312-3434 | 1234343425262837 | 1111 2323 2312 3434</matches>
<nonMatches>Non-Matches 1111 2323 2312-3434 | 34323423 | 1111-2323-23122-3434</nonMatches>
<completionRegex>^(\d{4}-){3}\d{4}$|^(\d{4} ){3}\d{4}$|^\d{16}$</completionRegex>
<previewRegex></previewRegex>
<errorMessage>Type 16 numbers in groups of 4 separated by -, ,or nothing</errorMessage>
</regExpression>
Note the <errorMessage> and <previewRegex> tags.
If a regex is entered in the Properties field, it will not be saved to the XML document).
The PreviewRegex and the CompletionRegex will normally be different. For example, the CompletionRegex may validate the format of a fully entered string (e.g. post / ZIP code, etc) while the PreviewRegex may be used to check that only valid characters are being entered.
It is best practice to disable Button controls to prevent clicking until the user enters valid values in all ValidationTextBox controls. To do this:
For a further example of this control, see the Subscripts Tutorial.
See also the Text Entry control.