Is your feature request related to a problem? Please describe.
When filling out a Questionnaire, if an item becomes disabled due to enableWhen logic, the previously entered answer is retained in the QuestionnaireResponse. This can lead to confusion because the disabled item is no longer applicable, but still contains a persisted value.
Describe the solution you'd like
Consider the following example:
- Item A (parent question): "Medication Given?"
- Item B (dependent question): "Medication Name"
- Item B is conditionally enabled using enableWhen only when Item A has the answer YES.
Example workflow:
- User sets Item A = YES
- User enters Item B = "Some Medication"
- User later changes Item A = NO (or clears Item A)
Expected behavior:
Item B should become disabled
The existing answer for Item B should be cleared/reset
The disabled item should no longer contribute a value to the QuestionnaireResponse
FHIR reference:
https://build.fhir.org/questionnaire-definitions.html#Questionnaire.item.enableWhen
Relevant specification text:
"If enableWhen logic depends on an item that is disabled, the logic should proceed as though the item is not valued..."
While the specification allows values to be retained internally when re-enabled later, persisting disabled answers in the QuestionnaireResponse can produce ambiguous or misleading data.
Describe alternatives you've considered
N/A
Additional context
Example code:
"item": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "radio-button"
}
]
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation",
"valueCode": "horizontal"
}
],
"linkId": "aws21.1",
"text": "Medication given?",
"type": "choice",
"repeats": false,
"required": false,
"answerValueSet": "#YesNo"
},
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
"valueString": "Medication Name"
}
],
"linkId": "aws21.2",
"text": "Medication Name",
"required": true,
"type": "string",
"enableWhen": [
{
"question": "aws21.1",
"operator": "=",
"answerCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0532",
"code": "Y",
"display": "Yes"
}
}
]
}
]
Is your feature request related to a problem? Please describe.
When filling out a Questionnaire, if an item becomes disabled due to enableWhen logic, the previously entered answer is retained in the QuestionnaireResponse. This can lead to confusion because the disabled item is no longer applicable, but still contains a persisted value.
Describe the solution you'd like
Consider the following example:
Example workflow:
Expected behavior:
Item B should become disabled
The existing answer for Item B should be cleared/reset
The disabled item should no longer contribute a value to the QuestionnaireResponse
FHIR reference:
https://build.fhir.org/questionnaire-definitions.html#Questionnaire.item.enableWhen
Relevant specification text:
"If enableWhen logic depends on an item that is disabled, the logic should proceed as though the item is not valued..."
While the specification allows values to be retained internally when re-enabled later, persisting disabled answers in the QuestionnaireResponse can produce ambiguous or misleading data.
Describe alternatives you've considered
N/A
Additional context
Example code: