So the reason you cant use the @Umbraco.Field is because Form.cshtml does not inherit UmbracoViewPage or UmbracoTemplatePage but instead it has a model of Umbraco.Forms.Mvc.Models.FormViewModel, so you cant get the UmbracoHelper without declaring it yourself.
However, this can be done quite easy. Add this to the Form.cshtml file:
@{
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
}
@(umbracoHelper.Field("aboutUs"))
How to render field inside Umbraco Form
I have installed Umbraco form and now want to output the field content inside Form.cshtml as follows
This keeps throwing errors. How do i go round this?
Hi Dem Muk.
So the reason you cant use the @Umbraco.Field is because Form.cshtml does not inherit UmbracoViewPage or UmbracoTemplatePage but instead it has a model of Umbraco.Forms.Mvc.Models.FormViewModel, so you cant get the UmbracoHelper without declaring it yourself.
However, this can be done quite easy. Add this to the Form.cshtml file:
Best of luck to you!!
Hi Dennis Adolfi
Thanks a lot. That fixed the problem.
Awesome Dem Muk!
Glad it worked out for you!
Best of luck with the rest of your site!
is working on a reply...