fix(classifieds): scope Quill submit handler to actual form
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
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) <noreply@anthropic.com>
This commit is contained in:
parent
9d5905e689
commit
e1a16e2542
@ -82,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-card">
|
<div class="form-card">
|
||||||
<form method="POST" action="{{ url_for('classifieds.classifieds_edit', classified_id=classified.id) }}" enctype="multipart/form-data">
|
<form id="classifiedForm" method="POST" action="{{ url_for('classifieds.classifieds_edit', classified_id=classified.id) }}" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -193,7 +193,7 @@ quill.root.innerHTML = {{ classified.description|tojson }};
|
|||||||
(function() {
|
(function() {
|
||||||
var qc = document.getElementById('quill-editor');
|
var qc = document.getElementById('quill-editor');
|
||||||
quill.on('text-change', function() { qc && qc.classList.remove('field-error'); });
|
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 html = quill.root.innerHTML;
|
||||||
var empty = (html === '<p><br></p>' || quill.getText().trim() === '');
|
var empty = (html === '<p><br></p>' || quill.getText().trim() === '');
|
||||||
if (empty) {
|
if (empty) {
|
||||||
|
|||||||
@ -270,7 +270,7 @@
|
|||||||
Ogłoszenie będzie widoczne przez 30 dni. Po tym czasie wygaśnie automatycznie.
|
Ogłoszenie będzie widoczne przez 30 dni. Po tym czasie wygaśnie automatycznie.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="POST" action="{{ url_for('classifieds.classifieds_new') }}" enctype="multipart/form-data">
|
<form id="classifiedForm" method="POST" action="{{ url_for('classifieds.classifieds_new') }}" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||||
|
|
||||||
{% if has_multiple_companies %}
|
{% if has_multiple_companies %}
|
||||||
@ -393,7 +393,7 @@ var quill = new Quill('#quill-editor', {
|
|||||||
// Clear error highlight as soon as user starts typing
|
// Clear error highlight as soon as user starts typing
|
||||||
quill.on('text-change', function() { qc && qc.classList.remove('field-error'); });
|
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 html = quill.root.innerHTML;
|
||||||
var empty = (html === '<p><br></p>' || quill.getText().trim() === '');
|
var empty = (html === '<p><br></p>' || quill.getText().trim() === '');
|
||||||
if (empty) {
|
if (empty) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user