Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Custom validation has no effect on server

default discord avatar
mebeigel2 years ago
3

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_not_jared
    2 years ago

    Did you restart your server after making the change?

  • default discord avatar
    mebeigel2 years 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_not_jared
    2 years ago

    Hey

    @1085301757556559943

    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
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.