November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
There no public method to reset form after submission. You need to write your own one to show the form again.
Hi Dac, thank you for your reply.
I have identified two elements that needs to be updated after submitting:
Do you see any other areas that should be updated as well, or any potential issues in resetting the form like this?
Hi,
If your form is sinlge step, I think it is ok. But if you implment progressive submit (multi step in multi page), you also should care about cookies.
@Jay Wilkinson this is the javascript code we ended up with:
resetForm(formContainer) {
if (formContainer) {
var formStatusMessage = formContainer.querySelector(".Form__Status__Message");
var formMainBody = formContainer.querySelector(".Form__MainBody");
var inputFields = formContainer.querySelectorAll(".ValidationSuccess");
if (formStatusMessage) {
this.clearClasses(formStatusMessage);
formStatusMessage.classList.add("Form__Status__Message", "hide");
}
if (formMainBody) {
formMainBody.removeAttribute("style");
}
if (inputFields) {
for (var i = 0; i < inputFields.length; ++i) {
inputFields[i].classList.remove("ValidationSuccess");
}
}
}
}
clearClasses(element) {
var cl = element.classList;
for (var i = cl.length; i > 0; i--) {
cl.remove( cl[0] );
}
}
Hi,
I am looking for a way to reset my form after submission, so the users can fill it out and submit it again. Is there a standard episerver method I can call to do this or do I need to write my own method that can reset all classes on the form elements, so it is visible again?
I am using EPiServer.Forms v4.9.1