Menu

Keep repeated checkbox values when building a query string
📰

Keep repeated checkbox values when building a query string

DEV Community: html·Vladyslav Yanchenko · Salestudia·2 days ago
#ymqgaR1L
#devto2#devto#dev#filters#output
Long article (630 words) — no AI summary yet.
Reading 0:00
15s threshold

AI disclosure: This article and its example were generated by an AI assistant.

A filter form often needs to send more than one value under the same key. If both Workshop and Talk are checked, the intended URL might be ?format=workshop&format=talk . One line of JavaScript can quietly erase one value: Object.fromEntries(new FormData(form)) . The form data is not a plain object. It can contain duplicate keys; an object cannot.

The example below is a static HTML file. It has no dependencies, sends no network request, and shows both the correct serialization and the lossy object side by side.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.