thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.72k stars 2.67k forks source link

Relationships and Validation #5731

Open Archivist121 opened 1 year ago

Archivist121 commented 1 year ago

Laravel version

9.31.0

PHP version

8.1.2

Voyager version

1.6.x-dev

Database

Maria

Description

I have an issue similar to: 4920 and 5108. After creating a relationship and setting them as "required" to have input, whenever I input anything into the field, the form still releases the error message and won't let me submit the form. If there is nothing in the field, the validation message also appears (which is the expected behaviour)

If I remove the JSON validation, it works but leads me to the DEBUG page.

4920 and 5108 said they were able to solve the issue but they didn't indicate how they managed to solve it.

Steps to reproduce

After creating a relationship: 1: Go to bread 2: Go to the relationship you created 3: Type the following in the "Relationship Details" field:

{
    "validation": {
        "rule": "required"
    }
}

Expected behavior

The error message should be shown if there is no input, if there is input then the form should be posted.

Screenshots

Image showing the validation JSON in the "Relationship Details": Required

Image showing the expected result if there is no input: Expected Same result even if there is a selected answer for the field.

Additional context

If the solution from 4920 and 5108 could be shared, I think that would solve this issue