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

Path in conditional handled different on server/client #5888

Open
tkalmar opened this issue Oct 30, 2024 · 3 comments
Open

Path in conditional handled different on server/client #5888

tkalmar opened this issue Oct 30, 2024 · 3 comments
Assignees

Comments

@tkalmar
Copy link

tkalmar commented Oct 30, 2024

Describe the bug
When i have the following form definition:

{
    "display": "form",
    "settings": {
        "pdf": {
            "id": "1ec0f8ee-6685-5d98-a847-26f67b67d6f0",
            "src": "https://files.form.io/pdf/5692b91fd1028f01000407e3/file/1ec0f8ee-6685-5d98-a847-26f67b67d6f0"
        }
    },
    "components": [
        {
            "label": "first",
            "tableView": false,
            "validateWhenHidden": false,
            "key": "first",
            "type": "container",
            "input": true,
            "components": [
                {
                    "label": "nested",
                    "tableView": false,
                    "validateWhenHidden": false,
                    "key": "nested",
                    "type": "container",
                    "input": true,
                    "components": [
                        {
                            "label": "Checkbox",
                            "tableView": false,
                            "validateWhenHidden": false,
                            "key": "checkbox",
                            "type": "checkbox",
                            "input": true
                        },
                        {
                            "label": "Text Field",
                            "applyMaskOn": "change",
                            "tableView": true,
                            "validateWhenHidden": false,
                            "key": "textField",
                            "conditional": {
                                "show": true,
                                "when": "nested.checkbox",
                                "eq": "true"
                            },
                            "type": "textfield",
                            "input": true
                        }
                    ]
                }
            ]
        },
        {
            "type": "button",
            "label": "Submit",
            "key": "submit",
            "disableOnInvalid": true,
            "input": true,
            "tableView": false
        }
    ]
}

The form renderer toggles the visibility of the textfield. When i submit this form, the value of the textbox is lost, because on the server the visibility is determined as not visible and the value is cleared.
So either the conditional calculation on the client is broken, and allows subpaths, or the calculation on the server side can't handle subpaths for visibility calculation.

Version/Branch

5.0.0-rc.91 at least also experienced in 4.0.2

To Reproduce

Create a Form with the given definition and submit it. The value for first.nested.textfield is lost

Expected behavior
A clear and concise description of what you expected to happen.
Either the toggling on client side should not work, or the server should not discard the value.

@VikkiAlenn
Copy link

@tkalmar The value of the textField is lost because the conditionals should be like

 "conditional": {
                                "show": true,
                                "when": "first.nested.checkbox",
                                "eq": "true"
                            }

Let us know if you still have questions.

@tkalmar
Copy link
Author

tkalmar commented Nov 14, 2024

@VikkiAlenn Yeah, that im aware of. The question is why is this "working" in the gui? Shouldn't the toggle in the guy also not work? The path behaves different in the gui ...

@VikkiAlenn
Copy link

@tkalmar Thank you for your contribution! We created a ticket for our dev team. For the reference: FIO-9380.

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