episphere / quest

experimenting with the idea of a questionnaire markup
https://episphere.github.io/quest/
2 stars 11 forks source link

Required question with 2 text boxes #393

Closed huip-ims closed 2 years ago

huip-ims commented 2 years ago

@danielruss @boyd-mj Hi Daniel - In the Biospecimen Survey, we have a required question with 2 text boxes. Is there a way to make both text boxes required within the same question? Currently, Quest is allowing the question to move forward if any 1 of the 2 boxes is answered. See example below.

[SRVBLU_COV3_V1R0!,displayif=greaterThanOrEqual(SRVBLU_COV2_V1R0,#loop)] When was the {##} time that you had COVID-19? If you are not sure, please make your best guess.

Month |||id=SRVBLU_COV3_MONTH_V1R0 min=1 max=12| Year |||||id=SRVBLU_COV3_YEAR_V1R0 min=2020 max=#currentYear|

danielruss commented 2 years ago

I will give it a test, but can you use

|date|id=datetest|

huip-ims commented 2 years ago

@danielruss @boyd-mj Daniel - I'm not sure NCI want a participant to recall a specific date for each of their COVID infections. Currently, they are just asking for month and year which are easier to remember, but I'll check with Julie while you do your test.

danielruss commented 2 years ago

@huip-ims Checking the code, it appears the functionality existed at one time. I am looking into how it is supposed to work and if I can get it working.

danielruss commented 2 years ago

@huip-ims

Try this:

[A1] Please answer the following:

Name: |__|id=name required|
Id: |__|id=test_id required|

[END]   Thank you
danielruss commented 2 years ago

This should only be used for questions that have MULTIPLE required responses. Otherwise, use our friend [Q1!]

huip-ims commented 2 years ago

@danielruss @naiyume @boyd-mj Daniel - Using the test code you provided, if any 1 of the 2 boxes is filled in, it requires you to fill in the null text box. However, if both text boxes are left missing, it allows the question to move forward, which we don't want. And, if I also use [A1!], this prevents moving forward when both text boxes are missing. Do you see any issues in using [A1!] in conjunction with your test code?

danielruss commented 2 years ago

@huip-ims Please try again.

@naiyume I have worked the "required" attribute into the validation. Please take a look at the code, see if you understand what I am doing. Future me, who never seems to understand my code, thanks you now.

huip-ims commented 2 years ago

@danielruss @naiyume @boyd-mj Daniel - It's working now. Both text boxes must be filled in before proceeding. Thanks!

huip-ims commented 2 years ago

@danielruss @guinevere83 Hi Daniel - we're noticing that the code below no longer works. We have a question in the biospecimen module with 2 text boxes that are both required. We coded it based on the example in your May 4th comment above, and it worked at the time. However, during today's test, it's allowing you to proceed if you provide 1 or no responses, and if responses are provided, it's storing the responses incorrectly (see {"SRVBLU_COV3_MONTH_V1R0_1%20required":"8","SRVBLU_COV3_YEAR_V1R0_1%20required":"2022"}} in screenshot below)

Has something changed in the renderer since May that may be causing this to no longer work?

[SRVBLU_COV3_V1R0!,displayif=greaterThanOrEqual(SRVBLU_COV2_V1R0,#loop)] When was the <b>{##}</b> time that you had COVID-19? If you are not sure, please make your best guess.

Month |__|__|id=SRVBLU_COV3_MONTH_V1R0 required min=1 max=12|
Year |__|__|__|__|id=SRVBLU_COV3_YEAR_V1R0 required min=2020 max=#currentYear|

image