I'm submitting an Umbraco Form using Ajax via a click event on the submit button.
var $form = $(this);
$.ajax({
type: 'POST',
success: function (result) {
$form[0].reset();
if (typeof grecaptcha !== 'undefined') {
grecaptcha.reset();
}
}
});
It works, and clears the form and resets the grecaptcha ok, but when I then re-use the the form including the recaptcha, and submit again, the form clears all the fields and then barks about missing field values, and the only fix at that point is to refresh the entire page, rather defeating the purpose of using Ajax.
It would seem that doing a form.reset using jQuery is not cutting it, and I need to do something else to make the form re-usable after an Ajax submit, without needing to refresh the entire page.
Reset form after Ajax Submission
I'm submitting an Umbraco Form using Ajax via a click event on the submit button.
It works, and clears the form and resets the grecaptcha ok, but when I then re-use the the form including the recaptcha, and submit again, the form clears all the fields and then barks about missing field values, and the only fix at that point is to refresh the entire page, rather defeating the purpose of using Ajax.
It would seem that doing a form.reset using jQuery is not cutting it, and I need to do something else to make the form re-usable after an Ajax submit, without needing to refresh the entire page.
Anyone have a solution for this?
is working on a reply...