Stay on page second visit problem
Hello!
I have a marketo form that keeps the user in the same page and show and embedded ty message, that's working fine, but if the user refresh the page he will see the second visit form, this form have the intention of send again the submit without completing the data again. The problem for this scenario is that when the user clicks the "submit again" button an error is fired, this because at that point the validation fails and we don't have access to the data that the user filled before.
const form = mktoForms2.getForm(formId);
// Here we don't have access to the values
const values = form.getValues();
//And we enter the if because of the !form.validate()
if (!form.submittable() || !form.validate()) {
// This if fires the error
This is only not working for this flow, because if instead of stay in this page we make a redirect to a thank you page or to the home and we come back to the page all works, we keep the data and the validation is true
So, my question here is, does marketo need a redirect to a different page to "store" the data filled for the user?
Or something different can be happening with my code? Because if I add a redirect after the submit the "second visit form works perfectly" and we only have the error when we keep the user in the same page.
Many thanks!
Jordan