Closed Jamaalkho closed 7 months ago
You haven't mentioned what version you are running, but assuming you are on 10 or up, the documentation for rendering forms is here.
If you are on Forms 8, you'll need to look at the legacy documentation, which can be found here.
Here's a couple of very basic template samples for rendering a form that may help too. They both assume you have a property on your document type with an alias of form
and a type of "Form Picker".
For Forms 10+:
@using Umbraco.Cms.Web.Common.PublishedModels;
@using Umbraco.Forms.Web;
@using Umbraco.Forms.Web.Extensions;
@using Umbraco.Cms.Core.Configuration.Models;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.HomePage>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
@if (Model.Form.HasValue)
{
@await Component.InvokeAsync("RenderForm", new { formId = Model.Form, theme = "default", includeScripts = true })
}
@Html.RenderUmbracoFormDependencies()
</body>
</html>
And Forms 8:
@inherits UmbracoViewPage<HomePage>
@using Umbraco.Forms.Mvc
@using ContentModels = Umbraco.Web.PublishedModels;
<!DOCTYPE html>
<html>
<head>
</head>
<body>
@Umbraco.RenderMacro("renderUmbracoForm", new { FormGuid = Model.Form })
@Html.RenderUmbracoFormDependencies()
</body>
</html>
Thanks, working...
Hello, I'm new to umbraco, i'm trying to integrate a form on a contact page. Using the form plugin, i have created a macro contact-form with parameters
And adding this code into my template :
`@inherits Umbraco.Web.Mvc.UmbracoViewPage
@using ContentModels = Umbraco.Web.PublishedModels;
@using Umbraco.Forms.Mvc
@{
Layout = "master.cshtml";
}
@Umbraco.RenderMacro("contactForm", new {formName="d5056b9d-70d3-4a6b-8d75-c5e81ed86452", formTheme="bootstrap3-horizontal"}) ` I don't know why i'm doing wrong here. Any idea please?
Thanks