How to add a masked text field
Contents
Introduction
This howto explains how to add a masked text field and column to the Openbravo system. A masked text can be used to force the user in entering text/string values in the correct format.
The steps to get a masked text field in your window consists of 2 steps: 1) create a reference defining the mask, 2) add a column to a table using the reference, and 3) add a field to a tab.
The last 2 steps are defined in detail in the following howtos:
This howto will only focus on the specific parts of a masked text field.
Example Module
This howto is supported by an example module which shows example of the code shown and discussed in this howto.
The example module adds a mask text field to the sales order header window. Please use an example module version of a release/implementation date of 23rd of January or later.
The code of the example module can be downloaded from this mercurial repository: https://code.openbravo.com/erp/mods/org.openbravo.client.application.examples/
Defining the Mask Reference
The first step is to create a specific reference for the mask and then set the mask in the mask reference child tab.
The mask reference must have the 'Masked String' as the parent reference and can not be a base reference. Then create a record in the 'Mask Reference' child tab defining the mask.
For information on how to define a mask see the description in the 'Masked String' parent reference.
Adding a column - selecting the correct reference
To get a mask text field, the first thing to do is to select the correct reference and reference search key when adding a column:
Create a field
Then create a field within the tab/window:
The result
The result is visualized as a masked text editor in form view: