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

valueInLegend doesn't work on checkboxes? #369

Open
natankeddem opened this issue Jun 28, 2021 · 6 comments
Open

valueInLegend doesn't work on checkboxes? #369

natankeddem opened this issue Jun 28, 2021 · 6 comments

Comments

@natankeddem
Copy link

Unless I am doing something wrong I can't seem to get any legend changes using checkboxes.

{
  "schema": {
    "foo": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "bar": {
            "type": "array",
            "title": "Options",
            "items": {
              "type": "string",
              "title": "Option",
              "enum": [
                "q",
                "w",
                "e",
                "r",
                "y"
              ]
            }
          }
        }
      }
    }
  },
  "form": [
    {
      "type": "tabarray",
      "draggable": "false",
      "items": [
        {
          "type": "section",
          "legend": "{{value}}",
          "items": [
            {
              "key": "foo[].bar",
              "type": "checkboxes",
              "valueInLegend": true
            }
          ]
        }
      ]
    },
    {
      "type": "submit",
      "title": "Go"
    }
  ]
}
@tchapi
Copy link
Member

tchapi commented Jul 1, 2021

I think you're hitting this limitation: It is restricted to direct children of tabarray fields for the time being.
See here: https://github.com/jsonform/jsonform/wiki#use-a-fields-value-as-tab-legend-with-value-and-valueinlegend

Can you try to remove one level between the tabarray and the checkboxes ?

@natankeddem
Copy link
Author

Not sure if that is valid, isn't the section inside the tabarray required? In any case just replacing the checkbox with a normal text input work correctly so I'm guessing this just isn't working correctly.

{
    "schema": {
        "foo": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "bar": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "form": [
        {
            "type": "tabarray",
            "draggable": "false",
            "items": [
                {
                    "type": "section",
                    "legend": "{{value}}",
                    "items": [
                        {
                            "key": "foo[].bar",
                            "valueInLegend": true
                        }
                    ]
                }
            ]
        },
        {
            "type": "submit",
            "title": "Go"
        }
    ]
}

@tchapi tchapi added the Bug label Jul 5, 2021
@sdetweil
Copy link
Contributor

sdetweil commented Sep 9, 2022

legend needs a text value, what is it for a checkbox?

@sdetweil
Copy link
Contributor

sdetweil commented Oct 1, 2022

@natankeddem

@natankeddem
Copy link
Author

natankeddem commented Oct 2, 2022

legend needs a text value, what is it for a checkbox?

Just saw your reply, sorry for the delay. I haven't looked at this in a few years now. I believe my original intent was to make the title of the legend tab text equal to the text of the checkbox strings. That would be "q", "w", "e", "r" or "y" from my example. Hopefully that makes sense.

@sdetweil
Copy link
Contributor

sdetweil commented Oct 3, 2022

@natankeddem thanks.. will examine

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

No branches or pull requests

3 participants