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

Boolean in radio mode not selected when having a custom True and False value #5471

Closed
PixelDonut opened this issue Jan 10, 2023 · 3 comments · Fixed by #5494
Closed

Boolean in radio mode not selected when having a custom True and False value #5471

PixelDonut opened this issue Jan 10, 2023 · 3 comments · Fixed by #5494
Assignees
Labels
Milestone

Comments

@PixelDonut
Copy link

Are you requesting a feature, reporting a bug or asking a question?

Bug report

What is the current behavior?

When de element type boolean is radio mode (when the screen is to small to show the slider) it doesn't show whether it is selected when you have a custom valueTrue and valueFalse

image

What is the expected behavior?

That the selected item shows that it is selected:

image

How would you reproduce the current behavior (if this is a bug)?

By setting a custom value in the boolean element and having it shown as a radio group.

Provide the test code and the tested page URL (if applicable)

Tested page URL:
https://plnkr.co/edit/vUSUNS6NfheubYuM

Test code

"elements": [
        {
            "type": "boolean",
            "title": "Boolean as radio",
            "labelTrue": "Yes",
            "labelFalse": "No" ,
            "valueTrue": 1,
            "valueFalse": 0,
            "renderAs": "radio"
        },{
            "type": "radiogroup",
            "name": "Radiogroup",
            "choices": [
              "No",
              "Yes"
            ]
          }]

Specify your

  • browser: Chrome
  • browser version: 108.0.5359.124
  • surveyjs platform (angular or react or jquery or knockout or vue): React
  • surveyjs version: 1.9.67
@JaneSjs JaneSjs self-assigned this Jan 10, 2023
@JaneSjs JaneSjs added the bug label Jan 10, 2023
@JaneSjs JaneSjs assigned dk981234 and novikov82 and unassigned JaneSjs and dk981234 Jan 10, 2023
@JaneSjs
Copy link
Contributor

JaneSjs commented Jan 10, 2023

Hello @PixelDonut,
Thank you for reporting this issue. We'll handle it shortly.

@OlgaLarina OlgaLarina added this to the v1.9.69 milestone Jan 10, 2023
@JaneSjs
Copy link
Contributor

JaneSjs commented Jan 13, 2023

Hi @PixelDonut,
As an immediate solution, you can use string literals as valueTrue and valueFalse values (https://plnkr.co/edit/mxCR5yJWNFg9Puh4).

{
   "type": "boolean",
    "title": "Boolean as radio",
    "labelTrue": "Yes",
    "labelFalse": "No" ,
    "valueTrue": "1",
    "valueFalse": "0",
    "renderAs": "radio"
}

@PixelDonut
Copy link
Author

Thank you, I'll have a look if this will work for our application.

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