Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visibilityIf no longer works when target is multiple Select widget #456

Open
aharaguchi opened this issue Nov 1, 2022 · 2 comments
Open

Comments

@aharaguchi
Copy link
Contributor

aharaguchi commented Nov 1, 2022

We recently upgraded to 2.8.4 and noticed that our form schemas' conditionals are no longer working.
2.8.1 seems alright whereas 2.8.2 isn't, so I believe this is the PR that broke it.

Expected Behaviour:
When selecting multiple options from the Select widget, each option selected should cause corresponding numerical fields to appear.

Current Behaviour:
The numerical field for only the first option selected appears.

I noticed that in 2.8.1's __evaluateVisibilityIf function, the value param would come in as "Option #1", "Option #2", etc.
in 2.8.4, only "Option #1" is ever passed into the function.

Form Schema:

    "properties": {
        "select1-8ab066ff9843": {
            "type": "array",
            "title": "Select",
            "widget": "select",
            "items": {
                "type": "string",
                "oneOf": [
                    {
                        "name": "Option #1",
                        "value": "Option #1",
                        "enum": [
                            "Option #1"
                        ]
                    },
                    {
                        "name": "Option #2",
                        "value": "Option #2",
                        "enum": [
                            "Option #2"
                        ]
                    },
                    {
                        "name": "Option #3",
                        "value": "Option #3",
                        "enum": [
                            "Option #3"
                        ]
                    }
                ]
            },
            "minItems": 1
        },
        "number1-6dc3da6da315": {
            "type": "number",
            "title": "1",
            "widget": "number",
            "visibleIf": {
                "oneOf": [
                    {
                        "/select1-8ab066ff9843/*": [
                            "Option #1"
                        ]
                    }
                ]
            }
        },
        "number2-00405c0b6224": {
            "type": "number",
            "title": "2",
            "widget": "number",
            "visibleIf": {
                "oneOf": [
                    {
                        "/select1-8ab066ff9843/*": [
                            "Option #2"
                        ]
                    }
                ]
            }
        },
        "number3-e38258301694": {
            "type": "number",
            "title": "3",
            "widget": "number",
            "visibleIf": {
                "oneOf": [
                    {
                        "/select1-8ab066ff9843/*": [
                            "Option #3"
                        ]
                    }
                ]
            }
        }
    }
}```
@aharaguchi aharaguchi changed the title visibilityIf no longer works with multiple Select widgets visibilityIf no longer works when target is multiple Select widget Nov 2, 2022
@KBroichhausen
Copy link
Contributor

Yeah, sorry. I introduced this bug by the feature. I already fixed it 17 days ago but it is not merged so far. See #452

@aharaguchi
Copy link
Contributor Author

Ooo thank you so much @KBroichhausen , this is awesome! I saw your PR but wasn't able to find the time to look into exactly what was going wrong with the issue. Appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants