Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
I need to render a different form view for a specific form in Contour. Using Umbraco v. 7.1.2 and Contour v. 3.0.21.
In Form.cshtml, I have a simple if statement checking if the form GUID is equal to the form I need rendered differently.
Snippet from Form.cshtml:
@if (Model.FormId.Equals(new Guid("831e7420-5d1f-4c71-8278-e62b46ba9a2f"))) { @Html.Partial("~/Umbraco/Plugins/umbracoContour/Views/NewsletterForm.cshtml", Model) } else { // Render the normal form view }
The newsletter form renders just fine, but when I click the submit button it gives me this:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
I've debugged the code and the exception seems to happen in this call:
@Html.RenderMvcAction(action, controller, formGuid, formtoken, (umbraco.MacroEngines.DynamicNode)Model, (System.Dynamic.DynamicObject)Parameter);
in MvcRenderContourForm.cshtml
MvcRenderContourForm.cshtml
I'm just not sure what collection is empty :-)
Is this the "right" approach to render forms with a difference view?
Thanks in advance!
Here is the official documentation for changing markup of contour forms : http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Custom-Markup/
Maybe these blog posts can be usefull too :
http://umbraco.com/follow-us/blog-archive/2012/11/8/contour-30-features-full-control-over-form-markup.aspx
http://www.nibble.be/?p=121
Comment author was deleted
You can have specific views for a single form, check documentation here http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Custom-Markup/ :)
Thanks guys, learned something new there :-)
I've simply created a new folder with the newsletter form guid, copied the original Form.cshtml to it and modified it and everything works as it should now.
Thanks again!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Render different view depending on form guid
Hi all,
I need to render a different form view for a specific form in Contour. Using Umbraco v. 7.1.2 and Contour v. 3.0.21.
In Form.cshtml, I have a simple if statement checking if the form GUID is equal to the form I need rendered differently.
Snippet from Form.cshtml:
The newsletter form renders just fine, but when I click the submit button it gives me this:
I've debugged the code and the exception seems to happen in this call:
in
MvcRenderContourForm.cshtml
I'm just not sure what collection is empty :-)
Is this the "right" approach to render forms with a difference view?
Thanks in advance!
Here is the official documentation for changing markup of contour forms : http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Custom-Markup/
Maybe these blog posts can be usefull too :
http://umbraco.com/follow-us/blog-archive/2012/11/8/contour-30-features-full-control-over-form-markup.aspx
http://www.nibble.be/?p=121
Comment author was deleted
You can have specific views for a single form, check documentation here http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Custom-Markup/ :)
Thanks guys, learned something new there :-)
I've simply created a new folder with the newsletter form guid, copied the original Form.cshtml to it and modified it and everything works as it should now.
Thanks again!
is working on a reply...