Exercise
Load and export a new checklist
Replace the checklist with a small CSV. Calculate the expected result before you run the page.
Files
Prompt to start
Adapt this checklist for a small fictional CSV with the exact header id,label. Each data line has two nonempty fields, commas are separators, and fields in these supplied samples have no commas, quotes or line breaks. Ignore blank lines. Reject duplicate IDs and bad rows and show the line if possible. Validate the whole file before replacing the existing list. Each successful load replaces the list, clears ticks and resets the count. Use the browser file picker; keep selected data on this device, with no network requests, storage or libraries. Export id,label,done with true or false. Keep the checkbox and Reset behaviour. Output one full HTML file. Current file: [paste it here].
Steps
- Paste your interactive page into the prompt, or start from the five-item fallback. Save the new version as setup-v4.html.
- Open the page and select the valid CSV twice. Confirm there are three rows each time. Tick one item.
- Select the invalid CSV. Confirm it reports the problem and keeps the valid list and tick.
- Export the result, open it in a text editor and compare its rows with the page.
This is an exercise about an explicitly small CSV format. A general CSV parser also needs to handle quoted commas, quotes and line breaks. Selecting a file in your local page reads it into that page; attaching it in a chat sends it to the chat service.
Check your result
- Valid file twice → 3 rows each time, 0 of 3 complete at load.
- Invalid file → duplicate ID error; 3 rows and the existing tick remain.
- Export → header and three rows, one true and two false.