To integrate Pardot form handlers with your Webflow site while continuing to use Webflow’s built-in success/error page styles, you'll need to submit the form data from Webflow to Pardot’s form handler endpoint using a hidden form action, and then handle redirection manually to show success or error states.
https://go.pardot.com/l/123456/2024-01-01/abc123).
POST
w-form-done and w-form-fail elements.fetch to Pardot
Use Webflow's Page Settings > Before </body> custom code section and insert JavaScript like this:
<script>
document.addEventListener("DOMContentLoaded", function () {
const form = document.querySelector("form");
form.addEventListener("submit", function (e) {
e.preventDefault();
const formData = new FormData(form);
fetch(form.action, {
method: "POST",
mode: "no-cors", // Pardot doesn’t support CORS; use no-cors to avoid browser block
body: formData
})
.then(() => {
// Show Webflow success message
form.style.display = "none";
document.querySelector(".w-form-done").style.display = "block";
})
.catch(() => {
// Show Webflow error message
document.querySelector(".w-form-fail").style.display = "block";
});
});
});
</script>
no-cors mode won’t return an actual response, assume success on .then() and trigger error only if .catch() occurs (e.g., user offline or JS error).
Use a Webflow form styled as you like and point it to your Pardot form handler endpoint using POST. Add custom JavaScript to disable native redirect behavior and display Webflow success/error messages instead. All form data will be received by Pardot while preserving your frontend experience.