Skip to content

feat: add index.html with test questions - #10

Merged
john merged 1 commit into
mainfrom
feat/test_form
Jul 28, 2026
Merged

feat: add index.html with test questions#10
john merged 1 commit into
mainfrom
feat/test_form

Conversation

@jdhoffa

@jdhoffa jdhoffa commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@john

john commented Jul 28, 2026

Copy link
Copy Markdown
Member

Form loads fine from http server, I was able to add values and generate json. There are no AC but I think that's the only requirement--there's no backend DB or any way to persist the generated json. There's a lot of fields so I just spot checked a handful, not all of them, but for what I did check, LGTM.

Going to merge myself since Jackson is on PTO.

@john
john merged commit 1a51cc6 into main Jul 28, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a standalone static HTML page that loads a CCDF/SECCDF release JSON and generates an interactive “answer form” UI for filling responses, validating basic field shapes, and exporting/copying the resulting JSON payload.

Changes:

  • Adds index.html with inline CSS + JS to load a framework schema (URL or local file) and render steps/sections/fields dynamically.
  • Implements lightweight client-side collection/validation for booleans, options, arrays, tables, and JSON-typed fields.
  • Adds JSON preview + clipboard copy + clear actions.
Comments suppressed due to low confidence (2)

index.html:399

  • For array-with-options fields, the main field label targets fieldId(field) but the checkboxes are created with ids like ${fieldId(field)}_0, so the label’s for points at a non-existent id. Update the main label to point at the first checkbox id.
  // Array with options → multi-checkbox group
  if (type === "array" && hasOptions) {
    const group = el("div", { class: "options-group", "data-role": "checkbox-array" });
    field.options.forEach((o, i) => {
      const cbId = `${fieldId(field)}_${i}`;
      group.appendChild(el("label", { for: cbId },
        el("input", { type: "checkbox", id: cbId, value: o }),
        el("span", {}, o),
      ));
    });
    wrap.appendChild(group);
    return wrap;

index.html:409

  • For freeform array fields, the main field label targets fieldId(field) but the generated row inputs have no id, so clicking the label won’t focus the field. Assign fieldId(field) to the first row’s input so the label points to a real control.
  // Array (freeform) → repeatable rows
  if (type === "array") {
    const list = el("div", { class: "array-list", "data-role": "string-array" });
    const addBtn = el("button", { type: "button", class: "mini", onclick: () => list.appendChild(makeArrayRow(list)) }, "+ Add item");
    list.appendChild(makeArrayRow(list));
    wrap.appendChild(list);
    wrap.appendChild(addBtn);
    return wrap;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread index.html
form.innerHTML = "";
$("#result-panel").textContent = "// Answers appear here after validation";
if (!state.schema) return;
const topic = state.schema.topic[state.topicIndex];
Comment thread index.html
Comment on lines +689 to +696
const topic = state.schema.topic[state.topicIndex];
const output = {
$framework: state.schema.$framework,
frameworkName: state.schema.name,
frameworkVersion: state.schema.version,
topic: topic.name,
answers,
};
Comment thread index.html
</header>

<main>
<div id="status"></div>
Comment thread index.html
Comment on lines +352 to +357
// Table (object with table schema) → dynamic rows
if (hasTable) {
const columns = field.table[0].columns || [];
wrap.appendChild(renderTable(field, columns));
return wrap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants