Copied to clipboard

Flag this post as spam?

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


  • Clare 37 posts 117 karma points
    Nov 10, 2014 @ 12:24
    Clare
    0

    Form not rendering on page when using Form Picker

    Hi, I'm struggling to render a form using the form-picker (rather than the editor using the insert macro - insert form from razor option)

    I've tried using this in the template but it doesn't work:

    <umbraco:Macro FormGuid="<umbraco:Item field="formContent" runat="server" />" Alias="umbracoContour.RazorRenderForm" runat="server"></umbraco:Macro>
  • Comment author was deleted

    Nov 10, 2014 @ 12:41

    You can't nest those tags, try using [#formContent] instead of the umbraco:item tags

    and are you running the site in webforms mode? Since those tags will only work for that

    If you are unsure could you let me know which umbraco version you are running and how the rest of your template looks?

  • Comment author was deleted

    Nov 10, 2014 @ 12:42

    Or if you insert the macro using the UI how does the macro snippet look then? 

  • Clare 37 posts 117 karma points
    Nov 10, 2014 @ 13:17
    Clare
    0

    Thanks Tim, I have to admit I'm out of my depth with this so am not exactly sure what needs to change from what you have suggested.

    Usually the editors insert a form using the [insert macro] - [Insert form from Umbraco Contour]

    If they do this then it works fine with the following in the template: 

    <umbraco:Item field="formContent" runat="server" />

    however, I wanted to make it easier for them by using the form picker.

    On some other templates where we know exactly which form is needed each time we use the following:

    <umbraco:Macro FormGuid="8491ffb7-2578-4208-bca0-19a16d212aa9" Alias="umbracoContour.RazorRenderForm" runat="server"></umbraco:Macro>

    which works well. I just don't know which line to put into the template when using the form picker.

    If you can suggest the actual line I need to add into the template for this option that would be great. Or do I need to set up a separate macro for rendering these?

    thanks again

     

  • Comment author was deleted

    Nov 10, 2014 @ 13:19

    if the property on your page has the alias formContent then it's (using this syntax it will fetch the formcontent property from the current page)

    <umbraco:Macro FormGuid="[#formContent]" Alias="umbracoContour.RazorRenderForm"runat="server"></umbraco:Macro>
  • Clare 37 posts 117 karma points
    Nov 10, 2014 @ 13:31
    Clare
    0

    Thank you Tim,

    Yes, the property alias is formContent.

    I tried that and got the following Parser Error:

    Server Error in '/' Application.


    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

    Parser Error Message: The server tag is not well formed.

    Source Error: 

    Line 39:      <umbraco:Item field="bodyText" runat="server" />
    Line 40:        <umbraco:Item field="formHeader" insertTextBefore="&lt;h2&gt;" insertTextAfter="&lt;/h2&gt;" runat="server" />
    Line 41: <umbraco:Macro FormGuid="[#formContent]" Alias="umbracoContour.RazorRenderForm"runat="server"></umbraco:Macro> Line 42:       <umbraco:Macro runat="server" language="cshtml">
    Line 43: @if (@Model.formHeader.ToString() != string.Empty)


    Source File: /masterpages/RecruitmentEvent.master    Line: 41 


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

     

  • Comment author was deleted

    Nov 10, 2014 @ 13:33

    think you need a space before the runat="server"

  • Comment author was deleted

    Nov 10, 2014 @ 13:34

    so

    <umbraco:Macro FormGuid="[#formContent]" Alias="umbracoContour.RazorRenderForm" runat="server"></umbraco:Macro>
  • Clare 37 posts 117 karma points
    Nov 10, 2014 @ 13:35
    Clare
    0

    Thanks so much Tim, all working now!

  • Comment author was deleted

    Nov 10, 2014 @ 13:39
Please Sign in or register to post replies

Write your reply to:

Draft