I am using react-app for my forms. I have added my netlify enabled forms code below. please let me know why my submitted form-data is not visible on netlify forms dashboard.
This is how I have set-up my contact form with netlify as per the netlify documentation and also enabled netlify forms in the netlify platform. Please help me. Still I cannot use submitted form data in dashboard.
Can you share the link to your form please?
Thank you @SamO for reaching out. My issue got resolved by adding async request using axios in the handleSubmit function. Now I am able to see form data in netlify. Thank you.
const handleSubmit = (e) => {
e.preventDefault();
if(validate()){
// Prepare form data for submission
const formData = new FormData();
formData.append(‘form-name’, ‘contact’);
Object.keys(formFields).forEach(key => {
formData.append(key, formFields[key]);
});
// Use Axios to submit the form data
axios({
method: 'post',
url: '/', // Your form's Netlify action URL; adjust if necessary
data: formData,
headers: { 'Content-Type': 'multipart/form-data' }
})
.then(response => {
console.log('Form submitted successfully:', response);
setIsSubmitted(true);
})
.catch(error => {
console.error('Form submission error:', error);
});
}
};


