diff --git a/apps/web/src/pages/FormEntryPage.tsx b/apps/web/src/pages/FormEntryPage.tsx index 320970b..f4c21dc 100644 --- a/apps/web/src/pages/FormEntryPage.tsx +++ b/apps/web/src/pages/FormEntryPage.tsx @@ -172,6 +172,18 @@ function EntryControl({ ); } +/** Read-only rendering of a stored value: decode code list values and map + * booleans to Yes/No, the same way the editable controls present them. */ +function readOnlyDisplayValue(def: ItemDef, codeList: CodeList | undefined, raw: string): string { + if (raw === "") return ""; + if (codeList) { + const item = codeList.items.find((i) => i.codedValue === raw); + return item ? (displayText(item.decode) ?? item.codedValue) : raw; + } + if (def.dataType === "boolean") return raw === "true" || raw === "1" ? "Yes" : "No"; + return raw; +} + /** Client-side dynamic form state (ADR-0014), recomputed on every edit. */ interface DynamicState { /** Field occurrences not collected under the current responses. */ @@ -282,7 +294,11 @@ function EntryGroup({
{editable && (values[key] ?? savedValue) !== "" ? ( @@ -294,7 +310,11 @@ function EntryGroup({ ) : isDerived ? ( ) : ( diff --git a/site/images/dynamic-fields.png b/site/images/dynamic-fields.png index 1ddd4f4..253525b 100644 Binary files a/site/images/dynamic-fields.png and b/site/images/dynamic-fields.png differ