Replies: 1 comment 6 replies
-
Here's an example of how you can tap on the existing validation errors. Screen.Recording.2022-12-14.at.7.12.35.PM.movmodule.exports = function registerHooks({ filter }, { exceptions }) {
filter('test.items.create', async (input) => {
if (!input.name) {
throw new exceptions.FailedValidationException({
message: 'Missing name',
path: ['name'],
type: 'custom.name.invalid',
context: {
invalids: [''],
},
});
} else if (input.name !== 'test') {
throw new exceptions.FailedValidationException({
message: 'Invalid name',
path: ['name'],
type: 'custom.name.invalid',
context: {
invalids: [input.name],
},
});
}
});
}; As the naming of |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
Let me start with the usual stuff - what a great product you've made here, thanks.
I've got a pretty advanced validation of a string field. The validation requires me to make a http request to an external service to check certain things. I can do that with the http-module.
However, is it possible to trigger this on insert/update and return an error message that result in the same red alertbox at the top as the native validation rules?
Beta Was this translation helpful? Give feedback.
All reactions