{"v":"<p dir=\"auto\"><strong>Revisited, 19 Oct 2026: answer lists get sections, and each list gets its own editor page.<\/strong><\/p>\n<p dir=\"auto\">At the 19 Oct meeting the customer asked for the allergies to come in <strong>sections<\/strong> (#81): No Known Allergies at the top, then Medications, Environmental and Food, then Other. Today a list is one flat run of choices, and the Answer Lists page shows every list on one page. Both change.<\/p>\n<h2 id=\"user-content-what-a-list-is-now\" dir=\"auto\">What a list is now<\/h2>\n<ul dir=\"auto\">\n<li><strong>Sections<\/strong> are headings inside a list, each with a name and a place in the order. Each choice belongs to one section. A list with no sections, like the equipment list today, works exactly as it does now.<\/li>\n<li><strong>Two kinds of choice stay outside the sections, in fixed places:<\/strong>\n<ul dir=\"auto\">\n<li>The choice that rules out the rest (&#34;No Known Allergies&#34;, &#34;None&#34;) is <strong>always first<\/strong>. The customer asked for this on both lists (#81, #135).<\/li>\n<li><strong>&#34;Other&#34;<\/strong> is <strong>always last<\/strong>, and it can&#39;t be switched off. Today it&#39;s an ordinary choice, so switching it off on the screen would leave &#34;Other allergy (specify)&#34; with nothing to open it. That&#39;s a gap in what was built on 19 Oct, and this fixes it.<\/li>\n<\/ul>\n<\/li>\n<li><strong>A section is only a heading.<\/strong> An answer stores the choice, never the section. So sections can be renamed, reordered, added or removed freely, and a choice can be moved to another section without touching any visit. A section can be removed once it&#39;s empty.<\/li>\n<li><strong>Choices keep their rules:<\/strong> they&#39;re never deleted, only switched off; their stored value never changes; edits reach visits prepared after the save.<\/li>\n<li><strong>The paper doesn&#39;t change.<\/strong> The ticked choices still print on the form&#39;s one line, in list order.<\/li>\n<\/ul>\n<h2 id=\"user-content-the-screens\" dir=\"auto\">The screens<\/h2>\n<p dir=\"auto\"><strong>Admin \u2192 Answer Lists<\/strong> becomes an index with one row per list. Each row shows the title, which form or forms use it, how many choices are offered, and who last changed it and when. Each row has an <strong>Edit<\/strong> button.<\/p>\n<p dir=\"auto\"><strong>Admin \u2192 Answer Lists \u2192 <em>list<\/em><\/strong> is a page per list (<code>\/admin\/answer-lists\/allergies<\/code>):<\/p>\n<ul dir=\"auto\">\n<li>One card per <strong>section<\/strong>, in order. Each card has a name box, move up\/down, and <strong>Remove<\/strong> (only when the card is empty). There&#39;s an <strong>Add a section<\/strong> button.<\/li>\n<li>Each card lists its <strong>choices<\/strong>: wording, Offered, move up\/down within the section, and a <strong>Section<\/strong> drop-down to move the choice to another section. An &#34;Add choices, one per line&#34; box adds new choices into that section.<\/li>\n<li>The fixed choices are shown in their places, not movable: the rule-out choice above the first section, &#34;Other&#34; below the last.<\/li>\n<li>A <strong>preview<\/strong>: the question as staff will see it at a visit, updated as you edit.<\/li>\n<li><strong>One Save for the whole page.<\/strong> The save carries the time the list was last changed. If someone else saved the list in the meantime, the save is refused with &#34;This list changed since you opened it&#34;, rather than one person&#39;s edit undoing the other&#39;s.<\/li>\n<li>Read-only for anyone with <code>admin.answerLists\/View<\/code> and not <code>Edit<\/code>.<\/li>\n<\/ul>\n<h2 id=\"user-content-under-the-hood\" dir=\"auto\">Under the hood<\/h2>\n<ul dir=\"auto\">\n<li><strong>Database:<\/strong> a new <code>form_answer_list_section<\/code> table (list, key, name, order) and a <code>fk_section<\/code> column on <code>form_answer_list_choice<\/code>. This goes in a new migration. Production hasn&#39;t run <code>20261019_answer-lists.sql<\/code> yet, so both go out together.<\/li>\n<li><strong>Definitions:<\/strong> a field gives its first sections, and each option names one (<code>&#34;section&#34;: &#34;medications&#34;<\/code>). That&#39;s how the allergy list as first written already arrives grouped. Until the customer saves a list, the definition&#39;s sections are the list&#39;s sections.<\/li>\n<li><strong>Visits:<\/strong> <code>answer_lists_json<\/code> copies the sections with the choices when a visit is prepared. The visit screen shows each section&#39;s name as a heading over its tick boxes.<\/li>\n<li><strong>Ticking &#34;No Known Allergies&#34; hides the other choices<\/strong> (#81). This goes in the engine for any rule-out choice, so &#34;None&#34; on equipment behaves the same way.<\/li>\n<li><strong>Rules, kept pure:<\/strong> section names must be filled in and differ from each other; each choice must be in a section that exists; the rule-out choice and &#34;Other&#34; can&#39;t be moved or switched off. These go in <code>code\/form_answer_list_rules.inc.php<\/code>, with tests in <code>scripts\/test-form-answer-lists.php<\/code> and the <code>-state<\/code> test.<\/li>\n<li><strong>Docs:<\/strong> <code>docs\/Forms.md<\/code> (sections in <code>options_from<\/code> lists), Changelog, UserChangelog.<\/li>\n<\/ul>\n<h2 id=\"user-content-not-in-this\" dir=\"auto\">Not in this<\/h2>\n<ul dir=\"auto\">\n<li><strong>Sections for the equipment list.<\/strong> None were asked for. The customer can add them on the screen if they want them.<\/li>\n<li><strong>Who gets the Answer Lists right.<\/strong> That&#39;s still waiting on the customer, as before.<\/li>\n<\/ul>\n"}