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...
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.
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.
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.
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...
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...
...I don't see any of the form fields - just "Previous" and "Next" buttons (and this is a single-step form).
Any ideas?
Mike
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?
Can you try something like
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
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?
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.
This is Umbraco 4.11.7 btw, and Contour 3.0.1.
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.
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
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.
I did install the security vulnerability patch when it first came out...
Ah great, I forgot we released a patch for 4.11.7. Then feel free to ignore me! :-)
Comment author was deleted
Hey Mike are you using a partial view macro or using the old macro razor scripts?
Comment author was deleted
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
is working on a reply...