Question T15572
Visible to All Users

Placement of toggle (Boolean question)

created a year ago

Hi,

I'm shooting you with a few questions so apologies for that. Thank you for your responsiveness.

The question I have is whether there is a possibility to align the answer option (Yes/No) for Boolean questions to the right, or to e.g. set a width of the question title when left aligning the question title in a Boolean question.

In the below example I do have a combinations of Boolean and Multi-select Matrix questions (with one column, which also is Boolean). What I want to achieve is the result to the right where the answer options are aligned for questions 1, 2(a-e) and 3.

From my understanding there is no suitable workaround out-of-the-box (e.g. if I were to use 1x1 multi-select matrix we cannot number specific rows).

Clipboard-File-2.png

Answers approved by surveyjs Support

created a year ago (modified a year ago)

Hello,
Thank you for your message. Unfortunately, there is no option to align a Boolean item with a matrix column. As an option, I may suggest that you replace the Boolean questions with a Multi-Select Matrix with one row. You can use the QuestionMatrixDropdownModel.showHeader and titleLocation settings to hide a matrix header.

Consider this example:

JSON
{ "pages": [ { "name": "page1", "elements": [ { "type": "matrixdropdown", "name": "question1", "titleLocation": "hidden", "showHeader": false, "columns": [ { "name": "Column 1", "cellType": "boolean" } ], "choices": [ 1, 2, 3, 4, 5 ], "rows": [ { "value": "Row 1", "text": "1. Do you do this?" } ] }, { "type": "matrixdropdown", "name": "question4", "title": "2. Do you do any of these?", "showHeader": false, "columns": [ { "name": "Column 1", "cellType": "boolean" } ], "choices": [ 1, 2, 3, 4, 5 ], "rows": [ "Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", "Row 7" ] }, { "type": "matrixdropdown", "name": "question2", "titleLocation": "hidden", "showHeader": false, "columns": [ { "name": "Column 1", "cellType": "boolean" } ], "choices": [ 1, 2, 3, 4, 5 ], "rows": [ { "value": "Row 1", "text": "3. And do you do this?" } ] } ] } ], "showQuestionNumbers": "off" }

Clipboard-File-1.png

Please let me know if you have any further questions.

Thanks

    Show previous comments (1)

      You're always welcome. Regarding numbering: if you wish to display a number besides a row title, you can hide the default title and specify the number within a row title.
      However, you can keep default numbering for other questions. To hide question numbers for particular question while include other questions in a numbering sequence, enable the settings.setQuestionVisibleIndexForHiddenTitle option.

      JavaScript
      import { settings } from "survey-core"; settings.setQuestionVisibleIndexForHiddenTitle = true;

      View Demo

      Please let me know if you have any further questions.

      Thanks

      We hope you enjoyed the level of service you received. If so, we would love if you could leave your feedback on SurveyJS page at g2.com. As we’re building our business, every review helps build credibility for future customers and your feedback would be greatly appreciated.

        Clipboard-File-1.png

        Yes, I understand that, but the UI will become ugly if doing this as the formatting of the question numbers will be different (see the difference in style and location of "1" and "2" in your example). But thanks for your help, I understand there will be limitations to everything. Today, we'll have to settle on as we do it currently, where the yes/no toggle will be placed at different locations for different questions (we are not fond of the option of hiding all question numbering and naming every single question with the the question number, as we dislike the styling of these questions). Thanks for your help!

          Hello,
          Thank you for the update. Yes, I understand the difference.

          we are not fond of the option of hiding all question numbering and naming every single question with the the question number

          Unfortunately, there is no such an option. You can hide default question numbers setting survey.showQuestionNumbers to false and manually specify numbers for survey questions. To obtain an array of survey questions, use the survey.getAllQuestions function.

          Should you have any further questions, please let me know.