I have a widget which contains a form. I want to do server-side validation and display validation errors as part of the widget.
However, since my widget could appear on any URL, I don't think I can return a View() from my controller action ([HttpPost] CreatePOST). So I have to return this.RedirectLocal(returnUrl).
Doing this means my form loses all its state and the user has to re-enter everything.
How can I preserve the form state after a post?
Also, for validation... can I get the validation errors to show up in
areas? This doesn't work if I am returning a RedirectLocal either.
I really don't want to return a redirect, but if I am just working within a widget I can't return an entire View(), as I would then lose the context of the page the widget is being rendered in.
I did look at one example in the Comments module - it preserves form state by returning the values in TempData, and manually populating them back into the form if they exist. This is not a good solution in my opinion, and my form is way too complex to be