{ "version": 1, "title": "Tutorial — Conditionals with Multi-select (selected())", "fields": [ { "id": "intro", "type": "note", "label": "When using select_multiple, you cannot use = to check a single value because the field stores multiple values. Use selected(field_id, 'value') instead. It returns true if that value is among the selected options." }, { "id": "services_present", "type": "select_multiple", "label": "Which services are present at this location?", "required": true, "options": [ {"value": "health", "label": "Health Center"}, {"value": "school", "label": "School"}, {"value": "water", "label": "Water Supply"}, {"value": "electricity", "label": "Electricity"}, {"value": "road", "label": "Paved Road Access"} ] }, { "id": "health_note", "type": "note", "label": "Health Center Details", "relevant": "selected(services_present, 'health')" }, { "id": "health_center_name", "type": "text", "label": "Health center name", "relevant": "selected(services_present, 'health')" }, { "id": "health_center_type", "type": "select_one", "label": "Health center type", "relevant": "selected(services_present, 'health')", "options": [ {"value": "hospital", "label": "Hospital"}, {"value": "clinic", "label": "Clinic"}, {"value": "post", "label": "Health Post"}, {"value": "mobile", "label": "Mobile Unit"} ] }, { "id": "school_note", "type": "note", "label": "School Details", "relevant": "selected(services_present, 'school')" }, { "id": "school_name", "type": "text", "label": "School name", "relevant": "selected(services_present, 'school')" }, { "id": "school_level", "type": "select_multiple", "label": "School levels offered", "relevant": "selected(services_present, 'school')", "options": [ {"value": "preschool", "label": "Preschool"}, {"value": "primary", "label": "Primary"}, {"value": "secondary", "label": "Secondary"} ] }, { "id": "water_note", "type": "note", "label": "Water Supply Details", "relevant": "selected(services_present, 'water')" }, { "id": "water_source_type", "type": "select_one", "label": "Water source", "relevant": "selected(services_present, 'water')", "options": [ {"value": "piped", "label": "Piped network"}, {"value": "well", "label": "Community well"}, {"value": "tank", "label": "Storage tank"}, {"value": "other", "label": "Other"} ] }, { "id": "water_continuous", "type": "select_one", "label": "Is water available 24 hours?", "relevant": "selected(services_present, 'water')", "options": [ {"value": "yes", "label": "Yes"}, {"value": "no", "label": "No — intermittent"} ] }, { "id": "location", "type": "geopoint", "label": "Location", "required": true }, { "id": "notes", "type": "textarea", "label": "Notes" } ] }