Copied to clipboard

Flag this post as spam?

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


  • lori ryan 199 posts 529 karma points
    Aug 04, 2020 @ 08:01
    lori ryan
    0

    Display umbraco form in fancybox

    I am opening the following partial via ajax. However the form isnt working just wondering what do I have to include to get it working or is there a better solution to get it working. None of the Js is working.

    @inherits UmbracoViewPage<formViewModel>
    
    
    @{
        var form = new Guid(Model.FormId);
        var theme = Model.formTheme;
        var includeScripts = "0";
        var recordGuid = Guid.Empty;
    }
    
    <div id="displayForm">
    
        @if (form != null)
        {
    
    
            Html.RenderAction("RenderForm", "UmbracoForms", new { formId = form, recordId = recordGuid, theme = theme, includeScripts = includeScripts });
        }
    </div>
    
    
    <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.0.0.min.js"></script>
    <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.16.0/jquery.validate.min.js"></script>
    <script src="https://ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive.min.js"></script>
    
  • David Houghton 8 posts 97 karma points
    Aug 04, 2020 @ 09:42
    David Houghton
    1

    Not had any experience with doing this via an Ajax request, but one pitfall that I did succumb to during a Forms and site upgrade was that inadvertently rendering two different versions (one in layout, one in a partial) of the JQuery scripts appear to break the Forms functionality. I assume this could also be the case even if the versions were identical but still being render multiple times... Hope this helps.

  • lori ryan 199 posts 529 karma points
    Aug 04, 2020 @ 15:44
    lori ryan
    0

    Unfortunately I dont think thats my issue even if I remove the cdn links the form doesnt work.

  • lori ryan 199 posts 529 karma points
    Aug 10, 2020 @ 09:44
    lori ryan
    0

    just for anyone else who comes across this couldnt get it to work, ended up building a seperate master template (which had no header and footer that just had the necessary Js and css) that called the render macros for the form and called that from the ajax to display in the fancybox, which worked.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies