iefieldkit icon indicating copy to clipboard operation
iefieldkit copied to clipboard

Ietestform - Suggestion: check for 'other' text field

Open stevenglover opened this issue 5 years ago • 2 comments

Check that there is an associated text field whenever 'other' is listed as a choice in a select_one or _multiple fields. Generate warning if text field doesn't exist or relevance isn't coded correctly.

I suppose this would need users to define a standard value that 'other, specify' is coded as in the input to running iefieldkit.

stevenglover avatar Aug 19 '19 07:08 stevenglover

Good suggestion! A few thoughts on how to implement.

  • To test which select fields have 'other' option we must test on the string other right? Cause that would mean that we can only do this test on English language forms. Or is there another way?
  • Is there any case when the specify other field does not come directly after the select field? For example:
    • a few questions are asked and then specify other fields for each of them comes all at once afterwards.
    • Or that the select field is a part of appearnce view like field-list and that the specify other question is asked outside the group meaning that there is a end group field in between?

I think it is not too difficult to implement a test for if specify other exist, once we have comprehensively laid out the case how that field can appear.

The most difficult part to code is to test if it is coded correctly, as there could be different styles, multiple conditions (e.g. only ask for specify other if two conditions apply) etc. That part I think is more difficult to implement. Unless we give a warning for all cases that is not coded like the most simple case, and then the user has to ignore the false positives.

kbjarkefur avatar Aug 20 '19 15:08 kbjarkefur

Instead of testing on a string, I would test on a unique value assigned to all 'other' option choices. For example, the surveys I program always have -9 for 'other', -8: don't know, -7: refuse, etc... So in this case the test for whether the text specify other field exists could then be for whether the relevance expression exists in any text field for this value. This would require the survey to have a unique value for 'other' choices, and this value to be defined in the ietestform command by the user.

So my idea would be that if a select_one or _multiple has 'othervalue' as a potential choice, then a text field would have either ${question} = 'othervalue' or selected(${question}, 'othervalue') as the relevance. I think this would overcome the issues you mention about the text field not coming directly after.

As you mention, it will be difficult to account for all situations, so therefore best probably to flag as warnings for incorrect cases. Perhaps output like this would be informative:

  1. A list of select_one and _multiple fields that DO NOT have 'othervalue' as a choice option (for manual user checking)
  2. Of those select_one and _multiple fields that DO have an 'other' field as an option, list those that DO NOT have a linked text field with a relevance expression described above (again, to flag for user to check if it functions correctly).

stevenglover avatar Aug 21 '19 05:08 stevenglover