# Changes ## [Unreleased] ### Added **RepeatingGroup Duplicate Detection** - Implemented duplicate item validation across all backends (CLI, TUI, Web) - Added `unique = true` attribute support to prevent duplicate items - Added item counter display updates in Web backend - New `is_duplicate()` function in CLI and TUI backends **Web Backend Improvements** - Refactored JavaScript: Replaced global constants with closure-based state management - Added `render_global_repeating_group_script()` for generic repeating group handling - Configuration stored in `data-*` attributes: `data-min-items`, `data-max-items`, `data-has-unique`, `data-unique-key`, `data-field-names` - Live item counter updates after add/delete operations - Single document-level event delegation for all repeating group interactions **Documentation** - Updated `docs/FIELD_TYPES.md` with unique validation details - Updated `examples/README.md` with RepeatingGroup testing commands - Added `docs/FIELD_TYPES.md` (new file) - Updated example forms with `unique = true` attribute ### Fixed - **CLI Backend**: Fixed validation of duplicate items in add/edit operations - **TUI Backend**: Fixed validation of duplicate items with error overlay feedback - **Web Backend**: Fixed `has_unique` flag reading from field definition (was incorrectly scanning fragment fields) - **Web Backend**: Fixed item counter not updating when adding/deleting items ### Changed **Architecture** - Each repeating group now maintains independent state via closure - Removed ~600 lines of dead code in Web JavaScript - Event handling now context-aware (finds correct repeating group controller) **Examples** - `examples/05-fragments/array-trackers.toml`: Added `unique = true` to UDP and HTTP tracker arrays - `examples/07-nickel-generation/arrays-form.toml`: Added `unique = true` to all RepeatingGroup fields ### Technical Notes - Duplicate detection compares ALL field values when `unique = true` - Works consistently across CLI, TUI, and Web backends - Backwards compatible: repeating groups without `unique = true` unaffected - max_items limit already enforced in all backends (no changes needed) ### Testing - All 174 unit tests passing - No clippy warnings - Build verified with `--all-features` flag - Manual testing in Web backend: duplicate detection working correctly - Item counter updates verified on add/delete operations