Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm having some challenges trying to get a multi-step form to work in Umbraco 9 using a ViewComponent.
My post method looks like this:
[HttpPost] [ValidateAntiForgeryToken] public IActionResult SubmitForm(IndmeldelsesformViewModel model) { if (!ModelState.IsValid) { return CurrentUmbracoPage(); } if (model.NextPage) { model.CurrentPage++; } if (model.PrevPage) { model.CurrentPage--; } model.CurrentPage++; return CurrentUmbracoPage(); }
and my ViewComponent is a simple one like this:
public IViewComponentResult Invoke() { return View(new IndmeldelsesformViewModel() { CurrentPage = 1 }); }
I can submit the form, but I'm having trouble figuring out how to retain the view model. How do I modify the view model in the SubmitForm function and return it to the ViewComponent?
Hi Thomas,
Did you manage to solve this issue? I'm facing exactly the same problem: can't figure out how to keep the Model on each step submission.
I have tried to use return PartialView() or View() but that way, it loses the page layout.
Does anyone know how to build a Multi-Step form in Umbraco 10?
Thanks
Hi @UmbracoTeam,
Can you please help us to solve this issue using view components
I gave up and used JotForm instead
Nick
For your View component, try defining it as below
public IViewComponentResult Invoke(IndmeldelsesformViewModel model) { nodel.CurrentPage = 1; return View(model); }
It's difficult to say precisely what you need without seeing your page templates.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Creating a multi-step form in Umbraco with ViewComponent
Hi
I'm having some challenges trying to get a multi-step form to work in Umbraco 9 using a ViewComponent.
My post method looks like this:
and my ViewComponent is a simple one like this:
I can submit the form, but I'm having trouble figuring out how to retain the view model. How do I modify the view model in the SubmitForm function and return it to the ViewComponent?
Hi Thomas,
Did you manage to solve this issue? I'm facing exactly the same problem: can't figure out how to keep the Model on each step submission.
I have tried to use return PartialView() or View() but that way, it loses the page layout.
Does anyone know how to build a Multi-Step form in Umbraco 10?
Thanks
Hi @UmbracoTeam,
Can you please help us to solve this issue using view components
I gave up and used JotForm instead
Nick
For your View component, try defining it as below
It's difficult to say precisely what you need without seeing your page templates.
is working on a reply...