NF11 VFormat RegEx

From iDempiere en

Feature: VFormat RegEx

Goal: Usability

Developer: Carlos Ruiz

Description:

Now you can add validation for Strings based on regular expressions using the VFormat definition.

This is achieved simply adding a VFormat starting with the prefix ~ and followed by the regular expression that you want to apply.

For example, the following regular expression can be used to validate Spanish person names:
^[A-Za-záéíóúÁÉÍÓÚñÑüÜ][A-Za-záéíóúÁÉÍÓÚñÑüÜ\s-]*$

But, to put it in the VFormat you must add the ~ prefix, like this:
~^[A-Za-záéíóúÁÉÍÓÚñÑüÜ][A-Za-záéíóúÁÉÍÓÚñÑüÜ\s-]*$

01 VFormat.png

This is what the user would see when entering an invalid Name:

02 Error.png

Furthermore, if you want to supply the user a more friendly error message you can define a Message for the regular expression itself, just the regular expressions, without the ~ prefix:

03 Message.png

And now the user would see the error like:

04 Error.png

Technical Info: IDEMPIERE-6096

Cookies help us deliver our services. By using our services, you agree to our use of cookies.