Form does not keep the submitted data when validation fails
I have the following problem:
simple contact form. If I omit for example a required field, then the form displays errors, but the data that was filled does not appear.
I would greatly appreciate if someone can explain to me why the submitted that is not displayed back.
I would expect that CurrentUmbracoPage(); just resubmits the POST method. instead it redirects to the RenderForm. Is this normal? Given that flow, how could I even expect the submitted model given I have a line that creates new one:
ContactUsViewModel model = this.contactUsViewModelFactory.CreateContactUsViewModel();
I am missing something - either the flow should not be returning to the RenderForm or somehow the old data from the post should be passed to it.
Form does not keep the submitted data when validation fails
I have the following problem:
simple contact form. If I omit for example a required field, then the form displays errors, but the data that was filled does not appear.
I would greatly appreciate if someone can explain to me why the submitted that is not displayed back.
I would expect that
CurrentUmbracoPage();
just resubmits the POST method. instead it redirects to theRenderForm
. Is this normal? Given that flow, how could I even expect the submitted model given I have a line that creates new one:I am missing something - either the flow should not be returning to the
RenderForm
or somehow the old data from the post should be passed to it.Here is the code:
The viewmodel is pretty standard I believe:
The partial _ContactUsForm.cshtml:
And the view itself has just slightly been modified to use the recaptcha:
is working on a reply...