Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions templates/add_product_gam.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h4 style="margin-top: 0; color: #856404;">⚠️ Inventory Not Synced</h4>
</div>
{% endif %}

<form id="product-form" method="POST">
<form id="product-form" method="POST" onsubmit="debugFormSubmission(event)">
<!-- Section 1: Product Basics -->
<h3 style="margin-top: 0; border-bottom: 2px solid #007bff; padding-bottom: 0.5rem;">Product Information</h3>
<p style="color: #666; margin-bottom: 1.5rem;">Basic product details that buyers will see</p>
Expand Down Expand Up @@ -474,7 +474,6 @@ <h3 style="margin-top: 2rem; border-bottom: 2px solid #007bff; padding-bottom: 0
// This format fits - show it
matchingCount++;
card.style.display = 'block';
checkbox.disabled = false;

// Auto-check if not already checked
if (!checkbox.checked) {
Expand All @@ -489,16 +488,19 @@ <h3 style="margin-top: 2rem; border-bottom: 2px solid #007bff; padding-bottom: 0
}, 2000);
}
} else {
// This format doesn't fit - hide it completely
// This format doesn't fit - hide it but preserve checked state
// User might have selected it deliberately, so don't uncheck it
// IMPORTANT: Don't disable checkbox - disabled inputs don't submit with form!
card.style.display = 'none';
checkbox.disabled = true;
checkbox.checked = false;
// checkbox.disabled = true; // REMOVED - would prevent form submission
// DO NOT uncheck: checkbox.checked = false;
}
} else {
// No dimensions - hide it
// No dimensions - hide it but preserve checked state
// IMPORTANT: Don't disable checkbox - disabled inputs don't submit with form!
card.style.display = 'none';
checkbox.disabled = true;
checkbox.checked = false;
// checkbox.disabled = true; // REMOVED - would prevent form submission
// DO NOT uncheck: checkbox.checked = false;
}
});

Expand Down Expand Up @@ -713,6 +715,22 @@ <h5 style="margin: 0;">Pricing Option #${index + 1}</h5>
}
}

// Debug form submission
function debugFormSubmission(event) {
const formatCheckboxes = document.querySelectorAll('input[name="formats"]:checked');
const formatValues = Array.from(formatCheckboxes).map(cb => cb.value);
console.log('[DEBUG] Form submission - checked formats:', formatValues);
console.log('[DEBUG] Form submission - total checked:', formatValues.length);

if (formatValues.length === 0) {
console.error('[DEBUG] NO FORMATS CHECKED ON SUBMIT!');
// Don't prevent submission, just log the issue
}

// Continue with form submission
return true;
}

// Filter formats based on search input
function filterGAMFormats() {
const searchInput = document.getElementById('format-search-input');
Expand Down