Freedom UI: How to validate one field based on another

Hi,

In Freedom UI, I need to validate a text field based on the value of a lookup field.

The first thing I tried was adding a custom validator in the validators block of the text field, using control.model.get(...) to access the lookup field value. However, in Freedom UI, control.model is undefined, so the validator doesn’t work.

What’s the correct way to perform cross-field validation in this case?

Thanks in advance!

Like 1

Like

2 comments

That is a really interesting question, I would like to know if anybody else has more information about this

Please use the approach with using the enableAttributeValidator and disableAttributeValidator methods as I described here https://community.creatio.com/questions/how-read-custom-attribute-or-other-field-value-validator#comment-91778

The validator will be only used as the error message sender while the actual check will be performed in the HandleViewModelAttributeChangeRequest.

Show all comments