            modal.style.display = "none";
            }
        }

        // Update the addMemberForm submission handler
        document.getElementById('addMemberForm').onsubmit = function(event) {
            event.preventDefault();
            const formData = new FormData(this);
            fetch(this.action, {
                method: 'POST',
                body: formData,
                headers: {
                    'X-CSRFToken': formData.get('csrfmiddlewaretoken')
                }
            })