From e1a16e25420850c9329b49f466e55217ed6f4463 Mon Sep 17 00:00:00 2001 From: Maciej Pienczyn Date: Tue, 14 Apr 2026 13:42:56 +0200 Subject: [PATCH] fix(classifieds): scope Quill submit handler to actual form document.querySelector('form') was matching the company switcher form in the navbar, not the classifieds form. Quill content was therefore never synced into the hidden description textarea, server saw it empty and rejected the submit with a misleading 'fill all fields' error. Added id='classifiedForm' to both new.html and edit.html and switched selectors to getElementById. Co-Authored-By: Claude Opus 4.6 (1M context) --- templates/classifieds/edit.html | 4 ++-- templates/classifieds/new.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/classifieds/edit.html b/templates/classifieds/edit.html index 39d3147..aa2c4ae 100644 --- a/templates/classifieds/edit.html +++ b/templates/classifieds/edit.html @@ -82,7 +82,7 @@
-
+
@@ -193,7 +193,7 @@ quill.root.innerHTML = {{ classified.description|tojson }}; (function() { var qc = document.getElementById('quill-editor'); quill.on('text-change', function() { qc && qc.classList.remove('field-error'); }); - document.querySelector('form').addEventListener('submit', function(e) { + document.getElementById('classifiedForm').addEventListener('submit', function(e) { var html = quill.root.innerHTML; var empty = (html === '


' || quill.getText().trim() === ''); if (empty) { diff --git a/templates/classifieds/new.html b/templates/classifieds/new.html index 42988bd..41b2c5f 100755 --- a/templates/classifieds/new.html +++ b/templates/classifieds/new.html @@ -270,7 +270,7 @@ Ogłoszenie będzie widoczne przez 30 dni. Po tym czasie wygaśnie automatycznie.
- + {% if has_multiple_companies %} @@ -393,7 +393,7 @@ var quill = new Quill('#quill-editor', { // Clear error highlight as soon as user starts typing quill.on('text-change', function() { qc && qc.classList.remove('field-error'); }); - document.querySelector('form').addEventListener('submit', function(e) { + document.getElementById('classifiedForm').addEventListener('submit', function(e) { var html = quill.root.innerHTML; var empty = (html === '


' || quill.getText().trim() === ''); if (empty) {