Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cannot make matrix questions required #170

Open
paleohug opened this issue Jan 23, 2025 · 8 comments
Open

Cannot make matrix questions required #170

paleohug opened this issue Jan 23, 2025 · 8 comments
Labels
bug Something isn't working

Comments

@paleohug
Copy link

Bug description

I am using a required_questions vector to manually manage the questions I want absolutely my participants to answer.
Among this varied list of questions (mc, mc_buttons, mc_multiple_buttons, matrix, text, textarea and numeric questions), matrix questions are not made required in the deployed survey.
Is there a specific trick to do it? Is it a bug?
Thanks in advance!

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Your environment

No response

@paleohug paleohug added the bug Something isn't working label Jan 23, 2025
@jhelvy
Copy link
Collaborator

jhelvy commented Jan 23, 2025

Hi, thanks for the issue. Can you provide a specific example of this not working for you? Are you trying to make individual items in the matrix required, or the entire matrix question (with all subquestions) required?

@paleohug
Copy link
Author

I want to make the entire matrix question required, just like any other types of question.

As an example:
In survey.qmd:

sd_question(
  type   = "matrix",
  id     = "archaeo_knowledge",
  label  = "Please rate your **theoretical knowledge** about the lithic industries of the following archaeological periods",
  row    = c(
    "Neolithic" = "neo",
    "Mesolithic" = "meso",
    "Upper Palaeolithic or Late Stone Age" = "up",
    "Middle Palaeolithic or Middle Stone Age" = "mp",
    "Lower Palaeolithic or Old Stone Age" = "lp"
    ),
  option = c(
    "Unknown" = "unknown",
    "Unfamiliar" = "unfamiliar",
    "Familiar" = "familiar",
    "Accustomed" = "accustomed",
    "Specialist" = "specialist"
  )
)

In app.R:

sd_server(
    required_questions = c("archaeo_knowledge")
)

In spite of being added in the required_questions function's vector (alongside other questions), matrix questions are not rendered as required in the deployed survey, while all the other types of question are.

@jhelvy
Copy link
Collaborator

jhelvy commented Jan 23, 2025

Okay, yes I can reproduce this issue. This must be a bug.

@pingfan-hu can you look into this? I also just added an additional numeric question, and I was able to proceed even without answering it. The numeric question has the red asterisk, but the matrix question does not. I thought we had addressed this long ago, but we must have broken something.

@jhelvy
Copy link
Collaborator

jhelvy commented Jan 29, 2025

Okay this will go on our todo list to update in the next version.

@pingfan-hu
Copy link
Collaborator

Got it. I'll add it to our to-do list.

@pingfan-hu
Copy link
Collaborator

OK it's on our list.

@pingfan-hu
Copy link
Collaborator

pingfan-hu commented Feb 4, 2025

Hi @paleohug ! Problem solved! Now we can properly set a matrix question as required. In your case, this will work properly:

sd_server(
    required_questions = c("archaeo_knowledge")
)

All subquestions will be defined as required, along with asterisk indicators.
However, we are in the middle of updating other features, so the new version won't be merged immediately. I'll let you know when we do the merge.

@paleohug
Copy link
Author

Thanks, that's amazing! Looking forward to the next update.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants