Send Form Data Before Gravity Forms Process

We have some JS that captures form data and sends it to a Google sheet when someone clicks “submit”. The problem is that it does not register if someone is on mobile since they sometimes press “Go” on iPhone.

Is there a way to initiate this script with a GF submission even when the data is not validate (missing field entries, etc) ?

Here is our current code. Using .submit() instead of .click does not work which is why we’re using click.

jQuery("input[type=submit].gform_button").click(function () {
				const scriptURL = "https://script.google.com/macros/s/API_KEY_HIDDEN/exec"
				const form = document.getElementById("gform_1")
				form.append("timestamp", new Date())
				fetch(scriptURL, {
						method: "POST",
						body: new FormData(form)
					})
					.then(response => console.log("Success!", response))
					.catch(error => console.error("Error!", error.message))
			});

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.