Can a custom validation error be added for Custom Component? If yes, can we prevent user from publishing if the field does not have required format?

Hi @olivela,

Please see this forum post, which demonstrates how to add an OnChange to your custom component’s JSON to run validation.

For example, you might write something like the following, where “MY_LIST” is the name of your list field:

onChange: (options) => {
        if (options.get('MY_LIST').length == 0) {
          alert('MY_LIST must have at least one entry!');
        }
      }

Thanks,
~Logan from Builder.io

1 Like