IDEMPIERE-6096 Implement regexp VFormat - improve message (#2306)

This commit is contained in:
Carlos Ruiz 2024-04-09 16:16:57 +02:00
parent 4ac98a630a
commit 0d0c33d197
1 changed files with 4 additions and 2 deletions

View File

@ -221,8 +221,10 @@ public class WStringEditor extends WEditor implements ContextMenuListener
// Validate VFormat with regular expression // Validate VFormat with regular expression
if (!Util.isEmpty(vFormat) && vFormat.startsWith("~")) { if (!Util.isEmpty(vFormat) && vFormat.startsWith("~")) {
String regex = gridField.getVFormat().substring(1); // remove the initial ~ String regex = gridField.getVFormat().substring(1); // remove the initial ~
if (!newValue.matches(regex)) if (!newValue.matches(regex)) {
throw new WrongValueException(component, Msg.getMsg(Env.getCtx(), "InvalidFormatRegExp", new Object[] {regex})); String msgregex = Msg.getMsg(Env.getCtx(), regex);
throw new WrongValueException(component, Msg.getMsg(Env.getCtx(), "InvalidFormatRegExp", new Object[] {msgregex}));
}
} }
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);