For some reason the added paragraph doesn't appear on the back end or front end when adding the macro (razor version) to the page. Any idea why? The help page says this:
Problem solved. Looking at Umbraco.Forms.Mvc.dll in reflector showed UmbracoFormsBusinessLogic.FieldViewResolver.GetFieldView method truncates the field name (before removing non regex word characters) to 0x4b (75 decimal) characters:
Click this button to confirm you agree to the terms and conditions and priv
Nice detective work! I really hope the new version of Contour (to be called Umbraco Forms) has a better way of customizing things like this (e.g., with a field alias so the caption can be changed without affecting behaviors like custom fields).
For anyone else wanting to insert an html snippet into a form that doesn't require editing capabilities on the back end. Here's the simple 5 minute hacky solution I came up with (when using Umbraco in Mvc mode), that took me over 2 hours to work out:
At the position you want the Html inserted, create a hidden field on the form with a name (caption) like "Do not edit or remove field one". (Hidden field makes the Html snippet full width, as the label is not displayed). Note: caption should be less than 75 characters to avoid problems discussed previously).
In the webroot folder, create your html snippet by adding it into this file (as per instructions on this page): \umbraco\plugins\umbracoContour\Views\Forms\85514c04-e188-43d0-9246-98b34069750c\FieldNameWithoutSpaces.cshtml (no need for a @model, and obviously the form GUID needs to be changed, and the field name replaced, lower case, without spaces).
It didn't cause us problems when emailing the form, although the empty value did get passed through in the email workflow, so long as you can live with that. One option would be to use an XSLT email and omit the field, but we didn't bother for our purposes.
Mvc: "Customize for a specific field an a form" not working
Umbraco: 6.1.5
Contour: 3.0.17
This Umbraco Contour help page has a section at the bottom entitled: Customize for a specific field an a form
I have a checkbox field at the bottom of the page that says this in the caption:
Click this button to confirm you agree to the terms and conditions and privacy policy
So inside the folder (I've verified the form GUID is correct):
\Umbraco\Plugins\umbracoContour\Views\Forms\67f4bc95-98a1-4f24-9f76-cb2a33e1164d
I have created the file called:
Clickthisbuttontoconfirmyouagreetothetermsandconditionsandprivacypolicy.cshtml
Which contains this code (standard checkbox cshtml file with a paragraph inserted at line 2):
For some reason the added paragraph doesn't appear on the back end or front end when adding the macro (razor version) to the page. Any idea why? The help page says this:
~\umbraco\plugins\umbracoContour\Views\Forms\85514c04-e188-43d0-9246-98b34069750c\FieldNameWithoutSpaces.cshtml
The form field doesn't have a "Field Name" field that I can see, only a "Caption" field.
Any idea what I'm doing wrong?
Problem solved. Looking at Umbraco.Forms.Mvc.dll in reflector showed UmbracoFormsBusinessLogic.FieldViewResolver.GetFieldView method truncates the field name (before removing non regex word characters) to 0x4b (75 decimal) characters:
Click this button to confirm you agree to the terms and conditions and priv
So the filename needed to be:
clickthisbuttontoconfirmyouagreetothetermsandconditionsandpriv.cshtml
Nice detective work! I really hope the new version of Contour (to be called Umbraco Forms) has a better way of customizing things like this (e.g., with a field alias so the caption can be changed without affecting behaviors like custom fields).
For anyone else wanting to insert an html snippet into a form that doesn't require editing capabilities on the back end. Here's the simple 5 minute hacky solution I came up with (when using Umbraco in Mvc mode), that took me over 2 hours to work out:
is working on a reply...