Custom Gravity Forms submit button not working

[ad_1]

I’m trying to have my own custom confirmation modal appear when I submit my form, but I cannot get it to submit. Only the gravity form button works and e.preventDefault() doesn’t work on it either and I’m really trying to eliminate the page from refreshing.

Can I not use my own button?

*const* inventorySubmit = document.querySelector(“.rep-modal-button”);
*const* realSubmit = document.getElementById(
“gform\_submit\_btuton\_11”
) as HTMLFormElement;
*const* formID = document.getElementById(“gform\_11”) as HTMLFormElement;
inventorySubmit?.addEventListener(“click”, (*e*) => {
e.preventDefault();
if (formID) {
realSubmit.disabled = true;
*// Attach an event listener for form submission*
formID.addEventListener(“submit”, () => {
console.log(“Form submitted successfully!”);
});
*// Submit the form*
formID.submit();
}
});

[ad_2]
2 Comments
  1. If you purchased a license for Gravity Forms you should reach out to their support. They’re very helpful.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer