Persisting data in form fields after form submission
I'm trying to have a form where if you select a certain option, we'll submit the form but also reload the page with all or most of the data in the fields intact so that you can submit the form again with similar data without having to fill out all the fields again. Problem is, the form is a partial view rendered inside a view, so if we try to return the view like return View(model) or any similar methods really, there is either an error or the page is loaded as raw htlm without any css (for some reason).
I also attempted to use both TempData and ViewBag, but whenever I set the value of the fields to either of these, the value tag in the html doesn't even appear.
The form is created with Html.BeginUmbracoForm and using a surface controller to handle the submission, which is where I try to set the TempData/ViewBag values that I pass to the view.
Persisting data in form fields after form submission
I'm trying to have a form where if you select a certain option, we'll submit the form but also reload the page with all or most of the data in the fields intact so that you can submit the form again with similar data without having to fill out all the fields again. Problem is, the form is a partial view rendered inside a view, so if we try to return the view like
return View(model)
or any similar methods really, there is either an error or the page is loaded as raw htlm without any css (for some reason).I also attempted to use both TempData and ViewBag, but whenever I set the value of the fields to either of these, the value tag in the html doesn't even appear.
The form is created with
Html.BeginUmbracoForm
and using a surface controller to handle the submission, which is where I try to set the TempData/ViewBag values that I pass to the view.Any ideas? Thanks!
Hi, I ended up using the HTTP session-state object for this. Not my favourite solution but it works.
is working on a reply...