Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ShowOrderForm.cshtml
@using Awesome.FormDemo.Controllers
@model Awesome.FormDemo.Models.TicketOrderModel
@if (TempData.ContainsKey("CustomMessage"))
{
<div>Hooray! - @TempData["CustomMessage"]</div>
}
else
{
using (Html.BeginUmbracoForm<TicketOrderController>("FormSubmit"))
{
switch (Model.StepIndex)
{
case 0:
@Html.LabelFor(m => Model.PersonalInfoStep.Name)
@Html.EditorFor(m => Model.PersonalInfoStep.Name)
@Html.ValidationMessageFor(m => Model.PersonalInfoStep.Name)<br />
@Html.LabelFor(m => Model.PersonalInfoStep.Email)
@Html.EditorFor(m => Model.PersonalInfoStep.Email)
@Html.ValidationMessageFor(m => Model.PersonalInfoStep.Email)
@Html.EditorFor(x => Model.TicketOrderStep, "HiddenForAll", "TicketOrderStep")
@Html.EditorFor(x => Model.TermsAgreementStep, "HiddenForAll", "TermsAgreementStep")
break;
case 1:
@Html.LabelFor(m => Model.TicketOrderStep.EventId)
@Html.EditorFor(m => Model.TicketOrderStep.EventId)
@Html.ValidationMessageFor(m => Model.TicketOrderStep.EventId)<br />
@Html.LabelFor(m => Model.TicketOrderStep.NumberOfTickets)
@Html.EditorFor(m => Model.TicketOrderStep.NumberOfTickets)
@Html.ValidationMessageFor(m => Model.TicketOrderStep.NumberOfTickets)
@Html.EditorFor(x => Model.PersonalInfoStep, "HiddenForAll", "PersonalInfoStep")
@Html.EditorFor(x => Model.TermsAgreementStep, "HiddenForAll", "TermsAgreementStep")
break;
case 2:
@Html.LabelFor(m => Model.TermsAgreementStep.Agreed)
@Html.EditorFor(m => Model.TermsAgreementStep.Agreed)
@Html.ValidationMessageFor(m => Model.TermsAgreementStep.Agreed)
@Html.EditorFor(x => Model.PersonalInfoStep, "HiddenForAll", "PersonalInfoStep")
@Html.EditorFor(x => Model.TicketOrderStep, "HiddenForAll", "TicketOrderStep")
break;
}
<input type="hidden" name="StepIndex" value="@Model.StepIndex"/>
<button type="submit" name="Previous" value="true">Previous</button>
<button type="submit" name="Next" value="true">Next</button>
}
}
@bronzewind

This comment has been minimized.

Copy link

bronzewind commented Jul 15, 2019

Hi Sebastiaan,

Thanks for this example. However I'm using Umbraco 8 and it doesn't works. Could you please share how does this works so that I can find out how to make it work in V8? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.