Copied to clipboard

Flag this post as spam?

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


  • Mike Taylor 155 posts 353 karma points
    Oct 15, 2013 @ 11:26
    Mike Taylor
    0

    Problem with usercontrol macro form in RTE, trying to render in .cshtml file

     

    If I embed a Contour form into a rich text editor via the usercontrol macro (has to be usercontrol macro rather than Razor macro), and then try to render it in a .cshtml file using this...

    @Html.Raw(umbraco.library.RenderMacroContent(thisPage.GetProperty("resources").Value, Model.Id))

    ...I don't see any of the form fields - just "Previous" and "Next" buttons (and this is a single-step form).

    Any ideas?

    Mike

  • Mike Taylor 155 posts 353 karma points
    Oct 15, 2013 @ 11:38
    Mike Taylor
    0

    If I look at the contents of umbraco.library.RenderMacroContent(....), I see this:

    <div id='contour' > <div class="contourNavigation"> <input type="submit" name="RenderForm_8$b_prev" value="Previous" id="RenderForm_8_b_prev" class="contourButton contourPrev" /><input type="submit" name="RenderForm_8$b_next" value="Next" id="RenderForm_8_b_next" class="contourButton contourNext" /> </div> </div>

    So it looks like there is a problem with umbraco.library.RenderMacroContent not outputting the Contour form properly from the usercontrol?

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 15, 2013 @ 12:20
    Fuji Kusaka
    0

    Can you try something like

     @Html.Raw(umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"yourMacro\" ></?UMBRACO_MACRO>", Model.Id)) 
  • Mike Taylor 155 posts 353 karma points
    Oct 15, 2013 @ 12:25
    Mike Taylor
    0

    Hi Fuji

    The form is embedded in a rich text editor, so I'm not directly rendering a specific macro - I'm rendering the content of the RTE field, which has the Contour usercontrol macro embedded into it.

    Mike

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 15, 2013 @ 17:36
    Sebastiaan Janssen
    0

    I don't get it.. has to be a usercontrol macro (why?) but then you have to render it in razor template? MVC mode or Webforms mode?

  • Mike Taylor 155 posts 353 karma points
    Oct 15, 2013 @ 17:40
    Mike Taylor
    0

    Webforms mode. I have a <form runat="server"> in my master template (and I have a bunch of other usercontrols in the site), but I'm using a .cshtml Razor file to display this particular page's content.

    The Contour form is embedded into the RTE using the Contour usercontrol macro (otherwise we end up with nested <form> tags), and my understanding was that @Html.Raw(umbraco.library.RenderMacro( {rich text editor value}... would render the Contour form, and it kind of does, but it doesn't show any of the fields - it just shows "Previous" and "Next" buttons.

  • Mike Taylor 155 posts 353 karma points
    Oct 15, 2013 @ 17:42
    Mike Taylor
    0

    This is Umbraco 4.11.7 btw, and Contour 3.0.1.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 15, 2013 @ 18:09
    Sebastiaan Janssen
    0

    First of all upgrade that one, it has a severe security vulnerability.

    Second, insert it as razor anyway. That seems to work. Yes, you will have nested forms but that should only be a problem if the page must validate.

    If it's in a razor macro, for some reason Contour doesn't see there's a form runat server tag there, in my version (latest) I see a big red message about it.

  • Mike Taylor 155 posts 353 karma points
    Oct 15, 2013 @ 18:13
    Mike Taylor
    0

    Unfortunately, IE8 has real problems with nested <form> tags. I've tried using Razor anyway, and in IE8, the layout of the page is completely broken (this is true, even if you just insert an empty <form> tag inside another form - nothing to do with Contour). This site has a significant IE8 audience, so that's not really an option...

    Any real reason why umbraco.library.RenderMacroContent doesn't work for Contour forms? I'm using it for other user controls with no issues...

    Mike

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 15, 2013 @ 18:26
    Sebastiaan Janssen
    0

    Ah okay, that sucks.

    Don't know, sorry. :) Make a support issue so Tim can have a look at it.

    http://umbraco.com/help-and-support/customer-area/contour-support-and-download/found-a-bug.aspx

    Oh and PLEASE do not ignore my plea to please please please upgrade your site to at least 4.11.9.

  • Mike Taylor 155 posts 353 karma points
    Oct 15, 2013 @ 18:28
    Mike Taylor
    0

    I did install the security vulnerability patch when it first came out...

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 15, 2013 @ 18:44
    Sebastiaan Janssen
    0

    Ah great, I forgot we released a patch for 4.11.7. Then feel free to ignore me! :-)

  • Comment author was deleted

    Oct 21, 2013 @ 09:26

    Hey Mike are you using a partial view macro or using the old macro razor scripts?

  • Comment author was deleted

    Oct 21, 2013 @ 09:29

    Can you try the following: use razor macro instead and update the Contour form view so it doesn't have the form tag http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Custom-Markup/

    So just remove the @using (Html.BeginForm("ContourForm", "FormRender", FormMethod.Post, new { enctype = "multipart/form-data" }))

    Think I've seen that work on a webforms site so worth a try

Please Sign in or register to post replies

Write your reply to:

Draft