NF11 VFormat RegEx
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-]*$
This is what the user would see when entering an invalid Name:
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:
And now the user would see the error like:
Technical Info: IDEMPIERE-6096