A formatter class provides formatting and validation functionality for the fields and inputs controlled by a Data Field Modifier builder call.
Formatter classes implement the com.bowstreet.methods.IInputFieldFormatter
interface and include code for the following aspects of formatting and validating form fields:
- Defines a list of expressions for formatting, translating, and validating inputs. These expressions describe a corresponding method that performs the operation and are used in the Data Field Modifier builder call to identify each of the methods in the formatter class.
- Implements format, translate, and validate methods.
- Implements utility methods to get and set error messages or get lists of expressions, for example.
The formatter takes raw phone number data (for example, 2075558487) and formats it to either a dot-separated format (for example, 207.555.8487) or a dash-separated (for example, (207)555-8487) format. It also makes sure that the user enters only numeric characters with its validate method.
You can implement any number of format, translation, or validation operations in a single formatter class.
Parent topic: Formatting and validating form values: wpf7