formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.89k stars 1.06k forks source link

Unable to override validation logic for custom component #5574

Open aarpyy opened 6 months ago

aarpyy commented 6 months ago

I have been unable to find in documentation or through looking at source code how a custom component can override validation logic. I'm opening this as a bug because Issue 4129 on this same repo opened this same issue as a bug with no response. Issue 369 was opened on the react repo and Issue 594 was opened on the angular repo, all for the same exact issue and no response.

I would greatly appreciate anyone's time and effort pointing me in the right direction, as I am largely unable to create the components I want without custom validation (the level of which I cannot do in the custom field in the schema).

dinbtechit commented 4 months ago

@aarpyy - Did you find any solution for this?

rzorzorzo commented 2 months ago

It would be great to have custom validation for all components, not only custom components. the backend may have restrictions on the api key or number of keys, ... it should be easy to implement something like:

builder( div, {customValidation: (comp) => {return "some message if not valid, else null"}})

for custom components, one can easily check if comp is the custom component.