• Hi, I’m using Contact Form 7 to add documents to a Firebase Firestore database. It works fine. However, after successfully submitting and creating one entry, if I try to submit an empty form, a new document identical to the previous one will be added. It seems that the system remembers the values from the previous request so a new document is created even the form is empty, and I can only update them by inputting new data or reloading the page.

    I wonder is there a way to solve this problem? Thank you.

    [hidden collectionName "collectionName"]
    [hidden databaseType "firestore"]
    
    <label for="answer">Question</label>
    [text answer]
    
    [submit id:if-data-submit "Submit"]
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Dale Nguyen

    (@hanthuy)

    I think it’s an edge case. Can you add required to one of the field, so user can’t continue if the form fields are empty?

    Thread Starter jliu33

    (@jliu33)

    No, as long as there are form input values being successfully submitted in the previous round, the value will be saved and can only be replaced either by entering new values or reloading the page. I tried to make sure the form is reset after the submission, but I think the issue is not on the contact form entry side. Is there a way to clear/reset the content of the POST request whenever a new collection is created?

    Plugin Author Dale Nguyen

    (@hanthuy)

    Thanks for the info. I will check this one on this weekend and get back to you.

    Plugin Author Dale Nguyen

    (@hanthuy)

    Hi @jliu33, could you please try it again?

    If it’s still doesn’t work, can you send me the test link?

    Thread Starter jliu33

    (@jliu33)

    Hi, thank you for the update. I’m sorry, but I may not be able to provide the test link. Currently, the entry with the type “number” will not trigger this bug, but for other terms, it still behaves the same. I might create a new form and check if the issue lies with the form itself.

    • This reply was modified 2 years, 10 months ago by jliu33.
    Plugin Author Dale Nguyen

    (@hanthuy)

    Please let me updated. And make sure to add * to make the form field required, it will help to prevent the error.

    Thread Starter jliu33

    (@jliu33)

    Ok, yes thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Contact Form Creating Duplicate Documents’ is closed to new replies.