Success Pages and Redirects
Success Pages and Redirects
Section titled “Success Pages and Redirects”After a form submission, you can redirect users to a thank-you page, show a success message inline, or let Formkove’s default page handle it.
Default Success Page
Section titled “Default Success Page”If you don’t specify a redirect, Formkove shows a built-in success page with a “Go Back” option. This works automatically for plain HTML form submissions.
Custom Redirect URL
Section titled “Custom Redirect URL”Add a hidden redirect field to send users to your own page:
<input type="hidden" name="redirect" value="https://yoursite.com/thank-you">Requirements:
- Must be a full URL with
https://— relative paths like/thank-youwon’t work - Cross-domain redirects (redirecting to a different domain) require a Pro or Agency plan
- Free plans: redirect domain must match the form’s domain
<!-- ✓ Correct --><input type="hidden" name="redirect" value="https://yoursite.com/thank-you">
<!-- ✗ Wrong — relative URL won't redirect --><input type="hidden" name="redirect" value="/thank-you">Inline Success with JavaScript
Section titled “Inline Success with JavaScript”If you’re using fetch to submit the form (not a traditional POST), you can show a success message on the same page without any redirect:
const form = document.getElementById('contact-form');const result = document.getElementById('form-result');
form.addEventListener('submit', async function(e) { e.preventDefault();
const formData = new FormData(form); const data = Object.fromEntries(formData.entries());
result.textContent = "Sending...";
try { const response = await fetch('https://app.formkove.com/api/forms/YOUR_FORM_ID/submissions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify(data) });
const json = await response.json();
if (response.ok) { result.textContent = "Message sent! We'll be in touch soon."; form.reset(); } else { result.textContent = json.error || "Something went wrong."; } } catch (err) { result.textContent = "Network error. Please try again."; }});Clearing Form Data After “Go Back”
Section titled “Clearing Form Data After “Go Back””If users hit the browser back button after submission, some browsers retain form values. To clear the form on page load:
<script> window.onload = function() { const form = document.getElementById('contact-form'); if (form) form.reset(); };</script>This prevents users from seeing stale data if they navigate back to the form page.