Copied to clipboard

Flag this post as spam?

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


  • Francis Gallagher 3 posts 54 karma points
    Jun 04, 2015 @ 13:27
    Francis Gallagher
    0

    UmbracoForms v4.1.3 with Hybrid = Donut Caching Problem

    Hi there,

    Any help would be appreciated. I had a look at the other post further down about an Umbraco Forms issue but it was of no help. I am able to render my forms on the page however when you click submit to POST this leads to a simple Null Exception error due to donut caching. 

    @Umbraco.RenderMacro("FormsRenderForm", new { FormGuid = "ee5ebbc1-df7b-46f5-bdee-328ecd40e424" })

    to get the form on my pages and just inherit Umbraco.Web.Mvc.UmbracoViewPage . I have tried using a maco and just the normal

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    But no luck from that.

    Any help would be appreciated.  I am currently on Umbraco v7.2.4 as well. 

    This issue was apparently resolved by another user by uninbstalling and installing the new beta version but I have sadly not had the same success. 

    Error Stack: http://pastebin.com/jJJLtrcR

     

     

  • Francis Gallagher 3 posts 54 karma points
    Jun 08, 2015 @ 13:03
    Francis Gallagher
    100

    Okay so I eventually got the answer. First off a previous post about uninstalling DonutCaching and Reinstalling with the Beta 1.3.1 helped for this

    PM > Install-Package MvcDonutCaching -pre To save you the google (unless a newer version is out by the time you read this).

    Secondly I had to change how I called the Form. I am not a .Net developer so feel free to correct my bad practices or code efficiency here.

    I created a controller called umbracoFormController.cs with the below content

    using DevTrends.MvcDonutCaching;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using Umbraco.Core;
    using Umbraco.Core.Models;
    using Umbraco.Extensions.BLL;
    using Umbraco.Extensions.Controllers.Base;
    using Umbraco.Extensions.Enums;
    using Umbraco.Extensions.Models;
    using Umbraco.Extensions.Models.Custom;
    using Umbraco.Extensions.Models.Generated;
    using Umbraco.Extensions.Utilities;
    using Umbraco.Web;
    
    
    namespace Umbraco.Extensions.Controllers
    {
        public class UmbracoFormController : SurfaceRenderMvcController
        {
    
            [ChildActionOnly]
            public ActionResult GetUmbracoForm(String FormIDString)
            {
                var model = new UmbracoForm()
                {
                    FormID = FormIDString
                };
    
                return PartialView("UmbracoForm", model);
            }
        }
    } 

    Next was my Model called umbracoFrom.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Umbraco.Core.Models;
    
    namespace Umbraco.Extensions.Models.Custom
    {
        public class UmbracoForm
        {
            public String FormID { get; set; }
        }
    }

    After that was my partial which I just called UmbracoForm.cs (nothing special in here)

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    
            @Umbraco.RenderMacro("FormsRenderForm", new { FormGuid = Model.FormID })
    

    And finally I called my forms using the partial with (note the ", true"    - this punches the hole in MVCDonutCaching )

    @Html.Action("getUmbracoForm", "UmbracoForm", new { FormIDString = "ee5ebbc1-df7b-46f5-bdee-328ecd40e424" }, true)

    And of course I just changed the ID as I needed. I did get the idea off of Jeroens earlier postings when questioned about a custom form but this is my implementation of it just for rendering normal UmbracoForms. I hope this helps someone as it plagued me for a few days.

Please Sign in or register to post replies

Write your reply to:

Draft