Advertisement
Guest User

Untitled

a guest
May 5th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. @using Sitecore.Globalization
  2. @model FormModel
  3.  
  4. @{
  5. var id = "Form" + Model.ShortFormId;
  6. }
  7.  
  8. <div class="layout layout-a">
  9. <div class="region region-a">
  10. <div class="region-inner">
  11. <div class="block block-size-a">
  12. @if (Model.ShowTitle) {
  13. <h4>@Html.Sitecore().Field("Title", Model.InnerItem)</h4>
  14. }
  15. @if (Model.ShowIntroduction) {
  16. @Html.Sitecore().Field("Introduction", Model.InnerItem)
  17. }
  18. @if (Model.ShowTitle || Model.ShowIntroduction) {
  19. <div class="divider"></div>
  20. }
  21. <div class="form form-vertical form-style-a form-validate form-vertical-style-a">
  22. @using (Html.BeginRouteForm(MvcSettings.SitecoreRouteName, FormMethod.Post, new { enctype = "multipart/form-data", id = Model.ID.ToShortGuid(), autocomplete = "off" }))
  23. {
  24. Html.EnableClientValidation(true);
  25. Html.EnableUnobtrusiveJavaScript(true);
  26. @Html.AntiForgeryToken()
  27. @Html.Sitecore().FormHandler()
  28.  
  29. @Html.Hidden(Constants.FormId, Model.ID.ToString())
  30.  
  31. if (Model.IsAjaxMvcForm)
  32. {
  33. <script>
  34. if (typeof ($scw) === "undefined") {
  35. window.$scw = jQuery.noConflict(true);
  36. }
  37. $scw(document).ready(function () {
  38. $scw("#@Model.ID.ToShortGuid()").ajaxForm({ targetId: "@id" });
  39. });
  40. </script>
  41. }
  42.  
  43. if (Model.Failures != null && Model.Failures.Count > 0)
  44. {
  45. // TODO: Markup for validation summary?
  46. <div class="form-validation-summary">
  47. @foreach (var failure in Model.Failures)
  48. {
  49. <span class="error-message">@Html.Encode(failure.ErrorMessage)</span>
  50. }
  51. <br />
  52. </div>
  53. }
  54.  
  55. if (Model.SuccessSubmit) {
  56. <p>
  57. @Html.Encode(!string.IsNullOrEmpty(Model.SuccessMessage) ? Model.SuccessMessage : Translate.Text("Default success message."))
  58. </p>
  59. }
  60. else {
  61. <div class="form-validation-summary">
  62. @*TODO: Markup for validation summary?*@
  63. @Html.ValidationSummary(false)
  64. </div>
  65.  
  66. @Html.EditorFor(x => Model.Sections)
  67.  
  68. <button class="btn btn-style-a">
  69. @Model.SubmitName
  70. <i class="icon icon-arrow-right"></i>
  71. </button>
  72. }
  73.  
  74. if (Model.ShowFooter && !Model.Footer.IsWhiteSpaceOrNull())
  75. {
  76. <div class="contact-smallprint">
  77. @Html.Sitecore().Field("Footer", Model.InnerItem)
  78. </div>
  79. }
  80. }
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement