Contentful logo

Contentful Community

Accessing validation errors from content model in editor extension

Hi folks, I’m experimenting with an editor extension and I’m trying to access the validation errors of a field with onSchemaErrorsChanged in componentDidMount but I’m getting onSchemaErrorsChanged is not a function errors.

Here’s the componentDidMount :

componentDidMount() {

  this.props.sdk.entry.fields.title.onSchemaErrorsChanged(function(errors) {
    console.log('Ping');
  });

}

Would appreciate a bit of help regarding how to make this work! :pray:

@ops1 This is currently not supported, as a field in an entry can consist of multiple locales. However, you can query for that specific FieldLocale and listen to that:

sdk.entry.fields.title
  .getForLocale("en-US")
  .onSchemaErrorsChanged(console.error);