Menu

#126 Cannot create conditions on questions with multiple answers

open
nobody
None
5
2009-03-06
2009-03-06
kswartz
No

Most conditions are based on radio buttons, but it's reasonable to expect that you may want to display questions according to selected checkboxes on a question that allows more than one answer.

For instance, if a question asks:

"What kind of vehicle(s) do you own?
[ ] Motorcycle
[ ] Car
[ ] SUV
[ ] Minivan
"

You may want to ask additional questions in a future section if they have a motorcycle, and other additional questions if they have a car.

The workaround is to split this up into separate questions and use Yes/No radio buttons. For example:

"Do you drive a motorcycle? () Yes () No
Do you drive a car? () Yes () No
...
"

This isn't necessarily a bad idea -- it may make reporting easier. But if you have a "checklist" of, say, ten items, this could make the survey considerably long by turning one question into ten.

The fix as I see it is to add a new conditional operation called "contains". For instance, you would say "Show question 42 is question 21 CONTAINS Motorcycle". The code fix is pretty easy:

1) if the response is an array, convert it to a comma-separated scalar (e.g.: "Motorcycle,Car,SUV"
2) perform your SQL query with LIKE '%$RESPONSE_VALUE%' in the where clause.

Discussion

  • kswartz

    kswartz - 2009-03-06

    Sorry, quick update: this is true for version 2.0.2. I haven't had a chance to look at 2.1.* yet, so if this is fixed there, my apologies.

     
  • Franky Van Liedekerke

    Well, feel free to make a patch available ...

    Franky

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.