Front-End & Daily

Workaround for the issue where using CF7 add confirm and Google Sheets Connector together adds duplicate entries to the spreadsheet

Workaround for the issue where using CF7 add confirm and Google Sheets Connector together adds duplicate entries to the spreadsheet

Regarding the Wordpress contact form plugin Contact Form 7,

when using "Contact Form 7 add confirm", the plugin that adds a confirmation screen, and
"CF7 Google Sheets Connector", the plugin that summarizes submission content in a spreadsheet, together,

I will introduce a workaround for the phenomenon where the same content is sent to the spreadsheet twice, once when transitioning to the confirmation screen and once when submitting.

Please note that I haven't found a fundamental solution, and this is merely a temporary workaround.

Table of Contents

Workaround

For the phenomenon where the content is sent twice, once on the confirmation screen and once on submission, we will temporarily give up on a direct fix.

Instead, we will make sure that the button text is entered into the "submit" column only upon submission,

When using Contact Form 7 add confirm and CF7 Google Sheets Connector together, two entries are registered in the spreadsheet

(In this example, row 5 should be used)

By applying a filter to the "submit" column, you can display only the submitted information.

Filter using a spreadsheet filter

This is the approach we will take.

Steps

There's no particular need to touch the confirmation button:

<input type="submit" value="Confirm">

The goal is to set some `name` attribute for the submit button.

<input type="submit" name="submit" value="Submit">

First, assign an ID or class to the submit button from the Contact Form 7 editing screen.

[submit id:submit "Submit"]

It will look like this:

WordPress Contact Form 7 Admin Screen

This will output as follows:

<input type="submit" id="submit" value="Submit">

Then, set the `name` attribute of the submit button using JS.

$("#submit").attr("name", "submit"); // Set the name attribute of the submit button to 'submit'
/* == or == */
document.getElementById("submit").setAttribute("name", "submit"); // If using vanilla JavaScript, it would be like this

With this, the "submit" information will only be sent upon actual submission.

Next, create a "submit" column in the spreadsheet (match it with the name attribute).

Create a submit column in the spreadsheet

The information will be entered like this:

Spreadsheet

Finally, apply a filter to the "submit" column.

Spreadsheet filter

What was happening

When "Contact Form 7 add confirm" and "CF7 Google Sheets Connector" are used together,

at the timing of transitioning to the confirmation screen,

WordPress Contact Form 7

and at the timing of submission, information is sent to the spreadsheet,

WordPress Contact Form 7 Confirmation Screen

resulting in the same information being sent twice to the spreadsheet.

Two identical entries appear in the spreadsheet

It would be a nightmare if users repeatedly went back and forth between the confirmation screen...

It's not certain, but it seems that according to the specifications of "CF7 Google Sheets Connector", information is sent to the spreadsheet when a button with type="submit" is pressed,

I believe it's sent twice because both the button to transition to the confirmation screen and the submit button are of type="submit".

Comments

After reviewing the content, we will publish it, omitting any personal information.

Enter your name and email address

Please enter if you would like a reply by email.

Personal information provided will not be disclosed. It will only be used for replies.

It will be sent directly. Please confirm and 'Submit'.

If this was helpful, we'd appreciate your support!
All support received will be used for childcare.

Author's Baby Registry (Amazon)

Send support via OFUSE

Alternatively, support me by buying something through the buttons below
(You don't have to buy the specific product at the link.)

Support me via Amazon

Support me via Rakuten

Support me via Yahoo!Shopping

PR

As an Amazon Associate, Ken earns from qualifying purchases.

Share

Share on Twitter Share on Facebook Share on LINE Share on Hatena Bookmark