Copied to clipboard

Flag this post as spam?

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


  • Ian Gerdes 10 posts 81 karma points
    Aug 19, 2016 @ 10:59
    Ian Gerdes
    0

    render form on all pages

    morning Nicholas

    i have a newsletter form which i want to display on all pages on the footer. is there an easy way to do that? i have included the file that renders the form on the footer which renders fine when i pick it on a page.

    @{ Html.RenderPartial("umbformulateFooter"); }

        @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using formulate.app.Types
    
    @{  
    
        // Get a view model for the picked form.
        var pickedForm = Model.Content.GetPropertyValue<ConfiguredFormInfo>("formPickerFooter");
        var vm = formulate.api.Rendering.GetFormViewModel(pickedForm.FormId, pickedForm.LayoutId,
            pickedForm.TemplateId);
    }
    
    
    
            <div ng-controller="formWrapper">
    
            <!-- Display the form. -->
            <div ng-if="status !== 'success'">
                <div class="">
       @if (pickedForm != null && pickedForm.FormId != null)
    {
        @Html.Partial("~/Views/Partials/Formulate/RenderForm.cshtml", vm)
    }
                </div>
            </div>
    
            <!-- Display the success message. -->
            <div ng-if="status === 'success'">
                Your request has been received!
            </div>
    
            <!-- Display the error message. -->
            <div ng-if="status === 'failure'">
                Unable to submit request. Please try again.
            </div>
    
        </div>
    
  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Aug 19, 2016 @ 13:55
    Nicholas Westby
    0

    I suppose the easiest way would be to pick the form from a property on the homepage, then get that value from all other pages. Would look something like this:

    var pickedForm = Model.Content
        // Get homepage.
        .AncestorOrSelf(1)
        // Get form from homepage property.
        .GetPropertyValue<ConfiguredFormInfo>("formPickerFooter");
    
  • Ian Gerdes 10 posts 81 karma points
    Aug 19, 2016 @ 14:54
    Ian Gerdes
    0

    cheers simple really!

Please Sign in or register to post replies

Write your reply to:

Draft