CommCare – Default Value for Multiple Select Question

commcare

Is there a way to pre populate a Checkbox question using a Default Value? For example, if I had a question like:

What are your favorite fruits?

  • Apple
  • Banana
  • Orange

And I wanted Apple (or Apple and Banana) by default to be checked, can I do that with the Default Value?

Best Answer

You can do this in one of two ways, both of which involve providing an entry in the Default Value section of the form builder.

  1. You can hard code a space separated list between single quotes
    • 'apple orange'
  2. You can use the join or concat functions to build that list dynamically in a way that generates a space separated list of values
    • join(' ', /data/path/to/repeat)