mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-11 03:59:35 +00:00
The previous implementation used inline onsubmit handlers with return confirmVersionChange(...), which could fail silently if any JavaScript error occurred on the page, causing the form to submit without confirmation. Fixes: - Use event.preventDefault() FIRST to ensure form never submits by default - Use DOMContentLoaded event listeners instead of inline handlers - Properly escape translation strings using json_encode filter - Wrap in IIFE with 'use strict' for better error handling - Use data-attributes to identify forms and pass isDowngrade state Fix DOMContentLoaded race condition in update form handlers The event listener was not attaching if DOMContentLoaded had already fired by the time the script executed. Now checks document.readyState and attaches handlers immediately if DOM is already ready. Added console.log statements to help debug form handler attachment. Use Stimulus controller for update confirmation dialogs The inline script was blocked by Content Security Policy (CSP). Stimulus controllers are bundled with webpack and properly allowed by CSP. - Create update_confirm_controller.js Stimulus controller - Remove inline script from template - Pass translation strings via data-* attributes |
||
|---|---|---|
| .. | ||
| admin | ||
| bundles/TwigBundle/Exception | ||
| components | ||
| form | ||
| info_providers | ||
| label_system | ||
| log_system | ||
| maintenance | ||
| parts | ||
| projects | ||
| security | ||
| settings | ||
| tools | ||
| users | ||
| _navbar.html.twig | ||
| _sidebar.html.twig | ||
| _toast.html.twig | ||
| _toast_container.html.twig | ||
| _turbo_control.html.twig | ||
| attachment_list.html.twig | ||
| base.html.twig | ||
| helper.twig | ||
| homepage.html.twig | ||
| main_card.html.twig | ||
| vars.macro.twig | ||