Skip to content
Open backoffice ↗

Native Umbraco integration · UMBRACO

Form Picker & Razor rendering

Select forms on content and render them with the native tag helper.

Add a picker to a Document Type

In Settings → Document Types, add a property using MegaForm Form Picker. Use an alias such as megaFormPicker. In Content, open a page of that type, choose the form and publish the page.

The picker chooses a form; your template decides where to display it. Add the MegaForm tag helpers to the relevant _ViewImports.cshtml:

@addTagHelper *, MegaForm.Umbraco

In the page template:

@{
    var formId = Model.Value<int>("megaFormPicker");
}
@if (formId > 0)
{
    <megaform form-id="@formId" content-id="@Model.Id"
              view-type="submit"></megaform>
}

Use your own property alias if it differs. The current page's content-id supplies embedding context, including relative Umbraco document prevalue sources.

Render with a ViewComponent

The equivalent server call is:

@await Component.InvokeAsync("RenderMegaForm", new {
    formId = Model.Value<int>("megaFormPicker"),
    contentId = Model.Id,
    viewType = "submit"
})

For a fixed form, the tag helper also accepts a known positive form-id. Prefer a picker for editor-managed content so changing the form does not require a code deployment.

Test the published page

Verify that the selected form is published, the page is published and the visitor meets the form's access requirement. Inspect the browser for missing assets if the markup is present but unstyled. Do not render the same form twice accidentally in both the page and a block.

Continue with Block Grid & Block List for reusable content elements.