Build a Tile Sample Observation Worksheet With HTML, CSS and JavaScript
by tilekindau in Design > Websites
27 Views, 0 Favorites, 0 Comments
Build a Tile Sample Observation Worksheet With HTML, CSS and JavaScript
This project builds a small browser worksheet for comparing up to three physical tile samples. It gives each sample the same five observation fields, lets you record a preference, and turns those notes into CSV text or a printable summary.
The useful part is the consistent structure: when you return to your samples later, you can see which notes were made in daylight, which were made under room lighting, and which describe the surrounding materials. The worksheet records your observations; it does not decide whether a tile is suitable for a particular installation.
The implementation uses three files and no external JavaScript libraries. It was developed for Tilekind with AI assistance and reviewed before its earlier publication on StackBlitz. This tutorial explains how the files work so that the project can be reproduced and understood.
Supplies
- A computer with a text editor and a modern web browser.
- The full HTML in Step 1, plus the attached style.css.txt and script.js.txt source files.
- Optional: physical samples to use after the page is working. Example labels in the screenshots are demonstration data, not product recommendations.
No paid software, account or build tool is needed to run the three files locally.
Put the Three Files Together
Create a folder called sample-worksheet.
Download the two text attachments below. Save style.css.txt as style.css and script.js.txt as script.js, using a plain-text editor and UTF-8.
Copy the complete HTML below into a third file named index.html. Keep all three files together, then open index.html in your browser. No build step or external library is required.
If the page has no styling, check that the filenames really end in .html, .css and .js rather than an extra .txt extension. The HTML references the stylesheet and script by their relative paths.
Downloads
Give Each Sample the Same Fields
In index.html, each sample is a fieldset with a legend. Its controls have unique IDs such as sample-1-label and sample-1-daylight. The visible labels use for attributes matching those IDs.
Each sample has space for a label and notes about:
- daylight;
- room lighting;
- nearby cabinetry;
- the worktop;
- texture and finish impressions.
Keeping the fields consistent makes side-by-side reading easier. All fields are optional. The page starts blank, so it does not imply that a particular colour or finish is the correct choice.
Arrange the Cards With CSS Grid
The desktop layout is controlled by:
The stylesheet changes the sample and preference grids to a single column at 680 pixels or less. Try narrowing the browser window to see the cards stack. minmax(0, 1fr) allows the columns to shrink without a long field forcing one column wider than its neighbours.
You can adjust the colours in the :root variables without changing the worksheet logic. Keep text and field borders easy to distinguish.
Keep the Preference Labels in Sync
In script.js, updatePreferenceLabels() reads each sample label and updates its matching preference option. For example, entering Example A changes the option to Sample 1 — Example A.
The input event listeners run this function as you type. The preference is still stored as sample-1, sample-2 or sample-3, so editing a label does not change which sample the option refers to.
Try entering three example labels, selecting one, and then changing its label. The displayed option should update. Use these example labels while checking the page, then start a fresh session for your own sample notes.
Make a CSV That Preserves the Notes
readNotes() collects the fields into a JavaScript object. makeCsv() turns that object into a header, three sample rows and one overall-preference row.
The csvCell() helper quotes every cell and doubles any quotes inside it. That preserves commas, quotes and line breaks in a note. It also prefixes formula-like text with an apostrophe to reduce the risk that spreadsheet software interprets a note as a formula.
Choose View CSV text to inspect the output. This is also the fallback if a browser or embedded preview blocks downloads: copy the text into a plain-text file named tile-sample-observation-notes.csv, saved as UTF-8. After editing a note, choose View CSV text again to refresh the output.
The download button prepares the same CSV, but delivery of the file depends on the browser and host. If a download does not appear, use the CSV-text method above to keep your notes.
Understand the Printable Summary
The print button calls preparePrintSummary() and then requests the browser's print dialog. The summary uses text elements created with textContent, keeping user-entered notes as text rather than HTML.
The @media print rules hide the editable form and display the summary. Notes that were left blank become Not recorded. A browser may offer printing or saving to PDF; availability depends on the environment.
An embedded preview may restrict printing. If the print dialog does not open, use the CSV-text method to preserve the notes.
Keep a Copy Before Leaving
The worksheet does not store notes between visits. Its code clears the fields on initialisation and on the pageshow event. Save or copy the output before refreshing, navigating away or closing the page.
The worksheet code contains no network requests, analytics or browser-storage calls. An online host has its own data and privacy practices, so that code-level statement is not a privacy guarantee about the hosting service.
Once the example labels work, begin a fresh session with your actual samples. Record the setting and lighting conditions that matter to your comparison. Visual preference remains separate from technical specifications and installation requirements.
The worksheet was prepared for Tilekind Australia, an Australian online tile retailer. Code was developed with AI assistance.