Hi Isomorphic,
the docs for ValidatorType.MASK mention:
I have a serverside custom validator that does not more than
Could I also do this with less code with a mask-validator or does the mask-validator only run client side?
It mentions JavaScript, so I'm not sure here. Either way, a clarification in the docs would help here.
And out of interest, what would be the best and most declarative way to make a value uppercase? I could also imagine doing this with a customUpdateExpression for example.
Best regards
Blama
the docs for ValidatorType.MASK mention:
If validation is successful a transformation can also be specified via the validator.transformTo property. This should be set to a string in the standard format for string replacement via the native JavaScript replace() method.
Code:
public class ValidatorSetStringToUppercase { public boolean condition(Object value, Validator validator, String fieldName, Map<Object, Object> record, DataSource ds, DSRequest request, HttpServletRequest httpServletRequest, ValidationContext validationContext) throws Exception { validationContext.setResultingValue(value != null ? value.toString().toUpperCase() : value); return true; } }
It mentions JavaScript, so I'm not sure here. Either way, a clarification in the docs would help here.
And out of interest, what would be the best and most declarative way to make a value uppercase? I could also imagine doing this with a customUpdateExpression for example.
Best regards
Blama
Comment