How to get Form Field Properties from FormFieldValidator

working on:

Adding support for adding configurable property that will be the filename that will be loaded for the specific JS.

There does not seem to be a way to get the current Field that was used during the Submission.

FormFieldValidator provides the Submitted Value and validatorContext which seems to only be able to return the validator’s config value.

How can the ID of the field that is part of the submission be retrieved from FormFieldValidator?

@thorben any ideas on this?


Get the Field Name/ID of the field that the validator is attached to:

    String submissionFieldName = validatorContext.getFormFieldHandler().getId();

Get the properties of the field:

and get a specific property:

Example: of setting a fileName from the property called “validator_file”

    String fileName = validatorContext.getFormFieldHandler().getProperties().getOrDefault("validator_file", fileNameDefault);

was based on

1 Like