View source | Discuss this page | Page history | Printable version   

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.

Bulbgraph.png   Masked text fields are available in MP20 and later MPs.

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/

Bulbgraph.png   The example module also contains implementations of other howtos.

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.


Howto-mask-text-reference.png


For information on how to define a mask see the description in the 'Masked String' parent reference.


Howto-mask-text-parent-reference.png


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:


Howto-mask-text-column-reference.png


Create a field

Then create a field within the tab/window:


Howto-rich-text-field.png


The result

The result is visualized as a masked text editor in form view:


Howto-mask-text-result.png

Retrieved from "http://wiki.openbravo.com/wiki/How_to_add_a_masked_text_field"

This page has been accessed 6,650 times. This page was last modified on 23 January 2013, at 14:43. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.