Custom validation has no effect on server

default discord avatar
mebeigel
2 months ago
4

I have a field I'm trying to disable validation on the server with

validate: () => true

, but this appears to only be effect client-side validation,

not

server-side validation, which is still failing. My understanding is that if I provide a function for the

validate

field in a Payload field, that should effect both the client and server side of things (

https://discord.com/channels/967097582721572934/1071412742273105950/1071429268007043143

). I've inserted some

console.log

s and I can verify that my custom

validate

function is getting run on the client but nothing is happening on the server.

  • discord user avatar
    Jarrod
    Payload Team
    2 months ago

    Did you restart your server after making the change?

  • default discord avatar
    mebeigel
    2 months ago

    Yes I have



    I have overriding one the fields for a collection with my own plugin, which does set the custom

    validate

    function. I couldn't find anything in the Payload docs, but are there any known patterns that would break overriding the

    validate

    function on the server but not client? (I can verify my custom function is firing on the client)

  • discord user avatar
    Jarrod
    Payload Team
    last month

    Hey @mebeigel if you are still running into this, please open an issue on github and follow the steps in the issue template so we can recreate and get to the bottom of it! Thanks!



    https://github.com/payloadcms/payload/issues/new?assignees=&labels=possible-bug&template=1.bug_report.yml
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.