episphere / quest

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

Text box values not displaying in grids #366

Closed joshid-ims closed 2 years ago

joshid-ims commented 2 years ago

Currently, we cannot display value of ‘Other’ text box in grids like below:

[PREWORKT2,displayif=and(equals(WORK6,1),equals(WORK,0))] Thinking about the one-way trip from your home to |displayif=or(equals(isNotDefined(PREWORKSTNUM,""),false),or(equals(isNotDefined(PREWORKFULLST,""),false),or(equals(isNotDefined(PREWORKAPT,""),false),or(equals(isNotDefined(PREWORKCITY,""),false),or(equals(isNotDefined(PREWORKCITY_FOLLOWUP,""),false),or(equals(isNotDefined(PREWORKST,""),false),or(equals(isNotDefined(PREWORKST_FOLLOWUP,""),false),or(equals(isNotDefined(PREWORKZIP,""),false),or(equals(isNotDefined(PREWORKZIP_FOLLOWUP,""),false),or(equals(isNotDefined(PREWORKCOUNTRY,""),false),equals(isNotDefined(PREWORKCOUNTRY_FOLLOWUP,""),false)))))))))))|{$PREWORKSTNUM} {$PREWORKFULLST} {$PREWORKAPT} {$PREWORKCITY} {$PREWORKCITY_FOLLOWUP} {$PREWORKST} {$PREWORKST_FOLLOWUP}{$PREWORKZIP} {$PREWORKZIP_FOLLOWUP} {$PREWORKCOUNTRY} {$PREWORKCOUNTRY_FOLLOWUP}||displayif=and(equals(isNotDefined(PREWORKSTNUM,""),true),and(equals(isNotDefined(PREWORKFULLST,""),true),and(equals(isNotDefined(PREWORKAPT,""),true),and(equals(isNotDefined(PREWORKCITY,""),true),and(equals(isNotDefined(PREWORKCITY_FOLLOWUP,""),true),and(equals(isNotDefined(PREWORKST,""),true),and(equals(isNotDefined(PREWORKST_FOLLOWUP,""),true),and(equals(isNotDefined(PREWORKZIP,""),true),and(equals(isNotDefined(PREWORKZIP_FOLLOWUP,""),true),and(equals(isNotDefined(PREWORKCOUNTRY,""),true),equals(isNotDefined(PREWORKCOUNTRY_FOLLOWUP,""),true)))))))))))|this address| on a usual workday, about how much time did you usually spend in each type of transportation?

grid? id="grid_PREWORKT2" ,displayif=and(equals(WORK6,1),equals(WORK,0)) Typical WORKDAY [ [PREWORKT2A,displayif=equals(PREWORKT1,0)] Car, van, or truck (includes carpools or van pools); [PREWORKT2B,displayif=equals(PREWORKT1,1)] Taxicab (includes, Uber, Lyft, or hired car); [PREWORKT2C,displayif=equals(PREWORKT1,2)] Motorcycle; [PREWORKT2D,displayif=equals(PREWORKT1,3)] Bus or streetcar/trolley, light rail/trolley; [PREWORKT2E,displayif=equals(PREWORKT1,4)] Commuter rail, subway, metro; [PREWORKT2F,displayif=equals(PREWORKT1,5)] Bicycle; [PREWORKT2G,displayif=equals(PREWORKT1,6)] Walking; [PREWORKT2H,displayif=equals(PREWORKT1,55)] Other;] //This should show the text typed in for Other but that is not currently supported

(0:Less than 15 minutes) (1:15 to 29 minutes) (2:30 to 59 minutes) (3:1 to 2 hours) (4:More than 2 hours) |

danielruss commented 2 years ago

updated code... I used this module as a small example that showed the bug. It now works, I selected Bicycle, Walking, and 55 -- Broomstick.

[PREWORKT1]
[0] Car, van, or truck [1] Taxicab [2] Motorcycle 
[3] Bus or streetcar/trolley, light rail/trolley 
[4] Commuter rail, subway, metro [5] Bicycle [6] Walking
[55] Other. [text box:lala]

|grid?|id="grid_PREWORKT2"|Typical WORKDAY |[
[PREWORKT2A,displayif=equals(PREWORKT1,0)] Car, van, or truck (includes carpools or van pools);
[PREWORKT2B,displayif=equals(PREWORKT1,1)] Taxicab (includes, Uber, Lyft, or hired car);
[PREWORKT2C,displayif=equals(PREWORKT1,2)] Motorcycle;
[PREWORKT2D,displayif=equals(PREWORKT1,3)] Bus or streetcar/trolley, light rail/trolley;
[PREWORKT2E,displayif=equals(PREWORKT1,4)] Commuter rail, subway, metro;
[PREWORKT2F,displayif=equals(PREWORKT1,5)] Bicycle;
[PREWORKT2G,displayif=equals(PREWORKT1,6)] Walking;
[PREWORKT2H,displayif=equals(PREWORKT1,55)] {$lala} ] 
|
(0:Less than 15 minutes)
(1:15 to 29 minutes)
(2:30 to 59 minutes)
(3:1 to 2 hours)
(4:More than 2 hours)
|

Notice that I removed the displayif in the question for simplicity. Also. a grid IS A question. You cannot have

[Q1] text text text...

|grid ...|

These will be on separate pages.

You want..

|grid|id=myid|Thinking about the one-way trip from your home to ...

Also. That logic is awfully long. Maybe you want to use the new logic.

If this works please close.

joshid-ims commented 2 years ago

We tested. If I just test the grid code, it works. But when we put the whole module in Quest for testing, no matter if the text box value is present or left blank, it shows as 'null' in the grid.

Also, we need to consider when user selects 'Other' (55) but leaves it blank, do you want to display 'Other' or 'null' is ok. Currently displayif does not work in grids. So we cannot check if the text box has value or if it is left blank.

danielruss commented 2 years ago

stale issue