#Bug in validation.

19 messages · Page 1 of 1 (latest)

lime karmaBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please help us help you making sure you:

  • Adding an explanation of exactly what you're trying to achieve.
  • Adding any and all related code or previous attempts.
  • Describing the exact issue or error you are facing.
  • Posting any screenshots if applicable.
  • Reading through https://stackoverflow.com/help/how-to-ask.

When you're done with this thread, please close it. Thanks! ✨

(If you have a support agreement and need help, please contact the core team via email.)

fading dome
#

First time validation:

#

Then I type a invalid e-mail (still good):

#

But then when I empty my e-mail field I get a 500 instead of the correct 400.

    {
        "message": "An unexpected error occurred.",
        "extensions": {
            "code": "INTERNAL_SERVER_ERROR"
        }
    }
]```
#

Instead of the correct errors:

    {
        "message": "Validation failed for field \"name\". Value is required.",
        "extensions": {
            "code": "FAILED_VALIDATION",
            "field": "name",
            "type": "required"
        }
    },
    {
        "message": "Validation failed for field \"message\". Value is required.",
        "extensions": {
            "code": "FAILED_VALIDATION",
            "field": "message",
            "type": "required"
        }
    },
    {
        "message": "Validation failed for field \"email\". Value doesn't have the correct format.",
        "extensions": {
            "code": "FAILED_VALIDATION",
            "field": "email",
            "type": "regex",
            "invalid": "adsfafd"
        }
    }
]```
#

This is my validation setup:

#

Also tried this:

low saddle
#

Drag Email isnt Null and empty under AND operator so that they become child of AND like this image

fading dome
#

Ah wow thanks @low saddle

#

But still get the error when I empty my field

#

Does the same with this configuration

#

fill something wrong -> get errors (correct)
then empty the field and submit the form again -> get internal server error (wrong)

low saddle
#

I guess it can be called an official bug got this error from server

fading dome
low saddle
fading dome
#

16 dec haha

#

Thats far away @low saddle

low saddle
#

checked various issues regarding validation on directus is patchy. I would recommend going with client side validation on forms before sending data to server