fix: reset all org form fields on open/close — stale data from previous org was polluting second org entry

This commit is contained in:
James 2026-03-17 14:10:08 -04:00
parent ec7b4c9706
commit 4a7698ed20
1 changed files with 17 additions and 2 deletions

View File

@ -1239,14 +1239,28 @@
// ---- Add Party Modal (3-step scrape flow) ---- // ---- Add Party Modal (3-step scrape flow) ----
let scrapedData = null; let scrapedData = null;
function openAddOrgModal() { function resetAddOrgForm() {
scrapedData = null; scrapedData = null;
// Step 1
document.getElementById('addOrgEmail').value = ''; document.getElementById('addOrgEmail').value = '';
document.getElementById('orgRole').value = '';
document.getElementById('scrapeError').classList.add('hidden'); document.getElementById('scrapeError').classList.add('hidden');
document.getElementById('scrapeLoading').classList.add('hidden'); document.getElementById('scrapeLoading').classList.add('hidden');
document.getElementById('scrapeBtn').disabled = false; document.getElementById('scrapeBtn').disabled = false;
// Step 2 — clear all org fields
const clearIds = ['orgName','orgDesc','orgRole','orgIndustry','orgWebsite','orgPhone',
'orgAddress','orgCity','orgState','orgFounded','orgLinkedIn'];
clearIds.forEach(id => { const el = document.getElementById(id); if (el) el.value = ''; });
document.getElementById('orgLogoWrap').classList.add('hidden');
document.getElementById('orgLogoImg').src = '';
// Step 3 — clear people
const pl = document.getElementById('peopleList'); if (pl) pl.innerHTML = '';
const np = document.getElementById('noPeople'); if (np) np.classList.remove('hidden');
// Required field errors
requiredFields.forEach(id => document.getElementById(id).classList.remove('field-error')); requiredFields.forEach(id => document.getElementById(id).classList.remove('field-error'));
}
function openAddOrgModal() {
resetAddOrgForm();
document.getElementById('addOrgTitle').textContent = 'Add Party'; document.getElementById('addOrgTitle').textContent = 'Add Party';
document.getElementById('addOrgHint').textContent = "Enter an email address or domain name \u2014 we'll look up the organization automatically."; document.getElementById('addOrgHint').textContent = "Enter an email address or domain name \u2014 we'll look up the organization automatically.";
document.getElementById('addOrgSubmitBtn').textContent = 'Add to Deal'; document.getElementById('addOrgSubmitBtn').textContent = 'Add to Deal';
@ -1415,6 +1429,7 @@
function closeAddOrgModal() { function closeAddOrgModal() {
document.getElementById('addOrgModal').classList.add('hidden'); document.getElementById('addOrgModal').classList.add('hidden');
resetAddOrgForm();
} }
function showAddOrgStep(n) { function showAddOrgStep(n) {