formr.org
formr.org copied to clipboard
get parameter unintuitive behavior
- [ ] Apparently only works at the beginning of a run if a label column has content
- [ ] Value cannot be referenced in a showif/label.
To specify a bit:
- If "get" is the first item of a run, it can be used with an empty "label" column.
- If it appears somewhere within a run, for example, when returning from an external site to formr, the "label" column must contain some text.
(That's what we discussed in the Google group)
However, I did a little more testing and found some more unexpected behavior:
- if the "label" column of the "get" call is empty (e.g., when using it at the beginning of the run) and no URL parameter is provided (i.e., by just accessing the study via mystudy.formr.org/ instead of mystudy.formr.org/?param=1), the value of the variable gets
"". - However, if the "label" column of the get call contains text and no URL parameter is provided, the value of the variable gets
NA.
Thus in one case I have to use is.na() and in the other case == "" to check if the variable is empty.
Hi @dgromer apparently @cyriltata cannot replicate this problem following your verbal explanation. Could you provide a run export of your tests that clearly shows the bug?
Here's a run that returns NA: https://get-url-parameter-test-label.formr.org/
And here's one that returns "": https://get-url-parameter-test-nolabel.formr.org/
One note: either the problem turned around or I described it the wrong way around the last time. The study with an empty "label" column returns NA, the one with text in the label column returns "".
Please find the JSON files of the runs including the study details here: get-url-parameter-test.zip