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 rendered as Checkbox doesn't display a label in PDF #297

Open
JaneSjs opened this issue Feb 7, 2024 · 1 comment
Open

Boolean rendered as Checkbox doesn't display a label in PDF #297

JaneSjs opened this issue Feb 7, 2024 · 1 comment
Labels
bug user issue An issue or bug reported by users.

Comments

@JaneSjs
Copy link
Contributor

JaneSjs commented Feb 7, 2024

User Issue: T16746 - survey-pdf
https://surveyjs.answerdesk.io/internal/ticket/details/T16746


View Demo

In a survey runner:
image

In PDF:
image
image

Expected behavior: in PDF, a label appears beside a checkbox.

@JaneSjs JaneSjs added bug user issue An issue or bug reported by users. labels Feb 7, 2024
@JaneSjs
Copy link
Contributor Author

JaneSjs commented Feb 12, 2024

We researched this task. Currently, a Boolean question rendered as 'checkbox' renders the labelTrue and labelFalse labels in PDF. Unfortunately, we may not change this behavior in the meantime and render the label instead because it may introduce a breaking change. While researching this task, we found another issue which highlights ambiguous settings of the 'checkbox' rendering mode. We may require to rework the 'checkbox' rendering mode in the future and eliminate those issues.

In the meantime, consider the following alternatives.

Option 1: Use the 'checkbox' rendering mode for a Boolean question and set the labelTrue and labelFalse properties to the label text.
You would require to copy the label to the labelTrue and labelFalse properties.
View Plunker

{
  "pages": [{
    "elements": [
      {
        "type": "boolean",
        "name": "Birthdate_Refused",
        "label": "Refused",
        "labelTrue": "Refused",
        "labelFalse": "Refused",
        "titleLocation": "hidden",
        "hideNumber": true,
        "renderAs": "checkbox",
        "valueTrue": 1,
        "valueFalse": 0
       }
    ]
  }]
}

Option 2: Use the Checkbox question instead of a Boolean question.
With this option, you would configure a regular Checkbox question with a single check item. Consider the following demo:
View Plunker

{
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "checkbox",
     "name": "Birthdate_Refused",
     "title": "Birthday",
     "hideNumber": true,
     "choices": [
      {
       "value": "refused",
       "text": "Refused"
      }
     ]
    }
   ]
  }
 ]
}

@dk981234 dk981234 assigned JaneSjs and unassigned dk981234 Feb 12, 2024
@JaneSjs JaneSjs removed their assignment Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug user issue An issue or bug reported by users.
Projects
None yet
Development

No branches or pull requests

2 participants