Implement a wizard type UI

Topics: Writing modules
Aug 7, 2012 at 3:56 PM

I need to implement a multi-step wizard like dialog. What would be the best way to do it in Orchard?

I need all steps to validate the data, show error messages if needed, put user input in session state and the last step to save to DB and do service calls or send email.

Developer
Aug 8, 2012 at 4:46 PM
Edited Aug 8, 2012 at 4:46 PM

Do it as you would normally in MVC: write a controller, implement some actions, or even use WF, done. Just make sure you append your controller's actions with the [Themed] attribute so that your views will be rendered into the Content zone.

Aug 9, 2012 at 5:34 PM

Thanks sfmskywalker, I would've got so stuck so many times without your and Bertrand help.

 

Another question, I have a three level deep 1.5 menu. When returning view from a Themed controller, how do I make a certain option in the menu selected?

Developer
Aug 9, 2012 at 7:32 PM

That's a good question. Although I haven't tried, one thing you could try is to create a Custom Link menu item with a URL that matches the generated url of your action's route.

Another way could be to implement INavigationFilter. It looks like you'll have a chance there to set a Selected property to True. The interesting part will be how you will "communicate" between your controller and your navigation filter. One way could be to set a value in the HttpContext.Items collection from your controller, and read that value from your navigation filter. Another way may be using WorkContext.SetState and GetState.