Copied to clipboard

Flag this post as spam?

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


  • Nick 84 posts 451 karma points
    Oct 23, 2018 @ 21:19
    Nick
    0

    Multiple instances of Plain JavaScript Template

    Hi Nick,

    Thanks again for your quick response before with my other query, hope you can help me again, I promises his will be the last time :-) I am using the Plain Javascript template to render 2 forms on the same page, created 2 doc types pick, and pick2, but in both instances the same form renders in both on the page, again not sure were I am going wrong, the code with the page is as follows:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using formulate.app.Types
    @using Terratype    
    @{
        Layout = "_Root.cshtml";
            // Get a view model for the picked form.
            var pickedForm = Model.Content.GetPropertyValue<ConfiguredFormInfo>("pick");
            var vm = formulate.api.Rendering.GetFormViewModel(pickedForm.FormId, pickedForm.LayoutId,
            pickedForm.TemplateId, Model.Content);
            var pickedForm2 = Model.Content.GetPropertyValue<ConfiguredFormInfo>("pick2");
            var vm2 = formulate.api.Rendering.GetFormViewModel(pickedForm2.FormId, pickedForm2.LayoutId,
            pickedForm2.TemplateId, Model.Content);
    }
    

    and further down the page 2 instances of the forms:

    <div class='row'>
              <div class="formulate-wrapper">
                        @Html.Partial("~/Views/Partials/Formulate/Responsive.Plain JavaScript.cshtml", vm)
                </div>
    </div>
    

    and also:

    <div class='row'>
                      <div class="formulate-wrapper">
                        @Html.Partial("~/Views/Partials/Formulate/Responsive.Plain JavaScript.cshtml", vm2)
                    </div>
                  </div>
    

    Any help would be much appreciated, thanks again.

    Nick

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Oct 23, 2018 @ 22:19
    Nicholas Westby
    0

    Not sure what's up with that. Maybe double check the properties to ensure they're picking the correct configured forms, then check each configured form to ensure they're picking the correct layout, then check each layout to ensure they're picking the correct forms.

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Oct 29, 2018 @ 16:16
    Nicholas Westby
    0

    You ever get it working? If not, I can take a deeper look.

  • Nick 84 posts 451 karma points
    Oct 30, 2018 @ 23:57
    Nick
    1

    Hi Nick,

    Thanks for getting back in touch, I managed to get the above code working in the end, just reinstalled the plugin again, the code may of been cached on the server.

    Thanks again, great addition to Umbraco.

    Cheers

    Nick

Please Sign in or register to post replies

Write your reply to:

Draft