Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Stoker 39 posts 72 karma points c-trib
    Sep 22, 2013 @ 22:49
    Paul Stoker
    0

    Process for creating MVC forms

     

    Hi, I understand this may have been asked before but I cannot find exactly what I'm looking for, so here goes.

    I need to create a wizard/multi step form in Umbraco 6.1 website and would like to know how anyone else would approach this in terms of redirecting/moving between different steps in the process.

    So far I've setup all the actions and surface controllers and I would ideally like to perform a Post-Redirect-Get between each step in the process which would mean some kind of redirect but how do I load the normal master template the other umbraco pages use?

    I kind of just need advice as how people use the CurrentUmbracoPage(), RedirectToUmbracoPage() and RedirectToUmbracoPage(int id) methods.

    The strategy I'm currently using is Ajax and Partial views but I'm always stuck with the same URL and back/forward browser buttons are redundant unless I do some funky historyjs stuff.

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Sep 23, 2013 @ 10:27
    Ismail Mayat
    0

    Paul,

    For E99 purchase contour you could save youself alot of work it works in mvc mode and webforms mode it will do exactly what you need.

    Regards

    Ismail

  • Paul Stoker 39 posts 72 karma points c-trib
    Sep 23, 2013 @ 10:48
    Paul Stoker
    0

    Hi Ismail,

    Thanks for the recommendation but I'm just working on my own and don't want to spend any money on plugins.

    The solutions I have thought of so far are:

    1. Use Ajax and return partial views to the same Umbraco page

    2. Postback to the same page with a query string parameter, e.g ?step=1 and choose the correct action to render in a condition statemen

    3. Create multipe umbraco pages each with a different action/controller embedded or in a macro

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Sep 23, 2013 @ 12:07
    Jeroen Breuer
    0

    Hello,

    I used solution 3 for a project and stored the data in a session so even if the user navigated away to another page and got back all the data was still available.

    If want an example of how to create forms with MVC have a look at the Hybrid Framework.

    Jeroen

  • Paul Stoker 39 posts 72 karma points c-trib
    Sep 23, 2013 @ 14:36
    Paul Stoker
    0

    Thanks Jeroen,

    I'll check out the Hybrid Framework, it looks really good at first glance.

  • John Hodgkinson 613 posts 355 karma points
    Dec 01, 2014 @ 20:51
    John Hodgkinson
    0

    I need to create some MVC wizard style apps as well... the wizard steps are dynamic in the sense that the data from the previous steps determine what form elements (and how many) are dynamically generated in the new step... I've created some ajax based wizards that work great for non-dynamic elements but once it gets dynamic, it appears to get tricky from there on out... this was way easy in .NET forms but in MVC looks like the partials aren't rendering correctly after step 1 (routing?)... I've tried Ajax.BeginFormExt and Html.BeginUmbracoForm with no luck... many thanks in advance!

  • John Hodgkinson 613 posts 355 karma points
    Dec 02, 2014 @ 14:45
    John Hodgkinson
    0

    did some playing around with the above suggestions and think I may go the Html.BeginUmbracoForm and the separate page route... would like to not have to add a separate page for each step but at least initially passing a querystring variable looks to effect the routing when the form is submitted...

    1. Use Ajax and return partial views to the same Umbraco page <- this works would when no dynamic controls or form elements athough I believe knockout could be used but am trying to keep this as simple as possible and also keep unobtrusive validation intact

    2. Postback to the same page with a query string parameter, e.g ?step=1 and choose the correct action to render in a condition statement <- from my initial testing, passing a querystring variable appears to get appended to the form action and then affects the MVC routing (I may be wrong about this)

    3. Create multipe umbraco pages each with a different action/controller embedded or in a macro <- this seems to work and as Jeroen states by storing the object data in session, makes for easy persisting and pre-population...

    will continue working through this but a lot of good advice from above. thanks guys!

Please Sign in or register to post replies

Write your reply to:

Draft