Validation for custom field

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hi!
I have created a custom field, when I create it, there is a “Regular Expression” field in the admin panel (for example). In the component plugin itself I get it via attribute.options props, but how do I return an error and prevent the field from saving when doing so ?
For example if I add a required property it triggers automatically, but what if I want to customize and, for example, somehow check the input string in my own way. I know about ways to do it at the level of the model where the field is added, but how to make it embedded in the field itself ? I can display UI Errors as normal, but it won’t interfere with saving the field.

Hi @devDalys, and welcome to the forum!

It is a bit unclear to me what your question is (the bold letters don’t improve readability neither :see_no_evil:). Do you want to validate an input in a different manner then a regex? Is it about the way that the error is being displayed in the CMS? Or is it something else?