Umbraco Forms 11.2 default theme location and how to render custom theme
Hi
We are using Umbraco form 11.2 and having issue rendering our custom theme. So we created a form using Umbraco Forms and we are trying to render using the following.
@(await Component.InvokeAsync("RenderForm", new { formId = new Guid(formId), recordId = Guid.Empty, theme = "my-theme", includeScripts = false }))
We have created a separate themes folder under Forms themes. We also tried to set the themes to default and then made some test changes to the class in default form file but it doesn't update the class on the front-end even to the default inside the Forms themes folder. I suppose Umbraco forms 11 doesn't have Applugins folder as well. So where is the default theme location. And how can we point it to our custom one.
Be interesting to see if you used the Macro approach like I have, whether your theme is picked up! and it's the ViewComponent approach where you have the issue, or whether it's all approaches!!!
Thanks for your response.
I am using the form picker in a Form Block and when i use
@await Umbraco.RenderMacroAsync("renderUmbracoForm", new {FormGuid=Model.FormToDisplay, FormTheme="ThemeName", ExcludeScripts="0"})
i get the error
Could not locate template for type FormBlock, expected file
~/Views/Elements/FormBlockView.cshtml
and when i use tag helper no form is shown.
Looks like there is something i am missing when i use rendermacroasync, where should the template be located any idea?
So basically none of the approaches are working for me.
RenderForm- form working but theme not picked
RenderMacroAsyn- throwing template error as above.
Taghelper- form not working.
The themes with Viewcomponent is working for me now. I kept the themes files at the incorrect path. I had Themes inside Themes. I have corrected that and themes are working now.
Umbraco Forms 11.2 default theme location and how to render custom theme
Hi
We are using Umbraco form 11.2 and having issue rendering our custom theme. So we created a form using Umbraco Forms and we are trying to render using the following.
We have created a separate themes folder under Forms themes. We also tried to set the themes to default and then made some test changes to the class in default form file but it doesn't update the class on the front-end even to the default inside the Forms themes folder. I suppose Umbraco forms 11 doesn't have Applugins folder as well. So where is the default theme location. And how can we point it to our custom one.
Any help will be appreciated.
Thanks
Hi Nidhi
I have a custom theme working in the location
/views/Partials/Forms/Themes/ThemeName
and on a Form Page which I've added a Form Picker to, I render it like this:
(My Form Picker field is called 'FormToDisplay')
This uses the approach of reusing the Macro called 'Insert Form With Theme' that Umbraco Forms ships with...
But you should also be able to use a TagHelper or a ViewComponent, according to the docs:
https://docs.umbraco.com/umbraco-forms/developer/rendering-forms
Be interesting to see if you used the Macro approach like I have, whether your theme is picked up! and it's the ViewComponent approach where you have the issue, or whether it's all approaches!!!
regards
marc
Hi Marc
Thanks for your response. I am using the form picker in a Form Block and when i use
i get the error
Looks like there is something i am missing when i use rendermacroasync, where should the template be located any idea?
So basically none of the approaches are working for me. RenderForm- form working but theme not picked RenderMacroAsyn- throwing template error as above. Taghelper- form not working.
Thanks
Nidhi
The themes with Viewcomponent is working for me now. I kept the themes files at the incorrect path. I had Themes inside Themes. I have corrected that and themes are working now.
is working on a reply...