Hi, I’m trying to render a Umbraco Form in footer which is a partial view.
I have rendered a form in a view with this code
@{
Layout = null;
var raw = Model.Value<string>("queryForm");
Guid.TryParse(raw, out var formId);
}
@if (formId != Guid.Empty)
{
@await Component.InvokeAsync(
"RenderForm",
new { formId = formId, theme = (string)null, includeScripts = true }
)
}
else
{
<p>No form selected.</p>
}
But the same code doesn’t work in the partial.
the property editor used to select the form via the backoffice is a form picker
Both forms are rendered in a page specific view, but the form that doesn’t work is in a partial footer view which is a partial that is render in the master template
that form doesn’t render at all, but I can render it by hardcoding the form GUID
like
`var testFormGuid = new Guid(“589045fd-8835-41be-9d55-17f24dedb003”);
@await Component.InvokeAsync(
"RenderForm",
new { formId = testFormGuid, theme = (string)null, includeScripts = true }
)`
It’s likely something about me rendering it in a partial and it’s not being able to access the context of the actual page cause it goes like Partial->Master->View, where Master->View works
Any ideas?
Sorry for the formatting, I wrote this on my phone:)