#Color field validation not showing
6 messages · Page 1 of 1 (latest)
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
Community-Help:
Hey @orchid sable sorry to hear you're having issues. @hushed bloom you mind jumping in here to help?
Hey @orchid sable. The thing to note custom field validation functions is that they override the payload field default validation methods. If you want call the defaults the recommended way is to import from 'payload' the field validation for the type that best fits your custom field and return that call instead of the result you would normally return. Does that make sense?
Alternatively you can always just copy the validation required logic from the text function which normally looks like this:
if (required) {
if (typeof value !== 'string' || value?.length === 0) {
return t('validation:required')
}
}
Hey @hushed bloom , I noticed that the 'Input' component for the color field doesn't handle errors. I've already addressed this issue and have submitted a PR to fix it. You can review the changes here: https://github.com/payloadcms/custom-field-guide/pull/5
I merged your PR, looked good. Thank you!