Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Roy Berris 53 posts 411 karma points
    1 week ago
    Roy Berris
    0

    Forms V10: Cannot render custom fieldtype with custom theme

    Hi, we upgraded to V10 recently. For some reason we can't seem to render a custom theme on our production environments. We had some problems with the Forms partials, so we removed them from the project. Now I have a custom theme in the Views/Partials/Forms/Themes folder. This is compiled in to the project now, so there are no razor files on the publish directory. When run from my local machine, I see the results I expected. But when run from azurewebsites, I get an exception that the custom fieldtype cannot be found (in the default theme folder).

    System.InvalidOperationException: The partial view '/Views/Partials/Forms/Themes/default/Fieldtypes/FieldType.CourseName.cshtml' was not found. The following locations were searched:\r\n/Views/Partials/Forms/Themes/default/Fieldtypes/FieldType.CourseName.cshtml
    

    I don't render the form from the partial, but in our form component we invoke the forms viewcomponent directly. (This is just what the macro does).

    @(await Component.InvokeAsync("RenderForm", new { formId = Model.FormId, theme = "mytheme", includeScripts = true }))
    

    I also updated the custom theme to the latest template found here, but there are no differences with the V9 version aside from some null checks: https://our.umbraco.com/FileDownload?id=23911

    I did make sure the removed additional files at destination flag is set to true. So old files, or cache, cannot be a problem.

    Any idea why it will not render our custom theme on a production environment?

  • Tarik Es 26 posts 148 karma points
    1 week ago
    Tarik Es
    0

    Not sure if this will make a difference, but change includeScripts from true to 1

  • Roy Berris 53 posts 411 karma points
    1 week ago
    Roy Berris
    0

    Don't think that is it :D. On my local machine it works fine, but for whatever reason it can't load the theme on my server and it will fall back to default

  • Tarik Es 26 posts 148 karma points
    1 week ago
    Tarik Es
    0

    Have you included the files in your project before publishing?

  • Roy Berris 53 posts 411 karma points
    1 week ago
    Roy Berris
    0

    Files are being compiled with the project because of the new production runtime mode. See: https://our.umbraco.com/documentation/Fundamentals/Setup/Server-Setup/runtime-modes

  • Tarik Es 26 posts 148 karma points
    1 week ago
    Tarik Es
    0

    Can't confirm for sure, but I did have a similar issue with other things regardless of the Runtime mode, and everything worked fine only once I included the files to the project and added to the csproj file - could be just my setup or it could be something else - but maybe just try and see.

  • Roy Berris 53 posts 411 karma points
    1 week ago
    Roy Berris
    100

    Decided to make a bug report on this. I don't think we are doing anything wrong at this time. Double checked the migration guide and did everything as described. So either the documentation is not complete, or it is an actual bug with forms.

    https://github.com/umbraco/Umbraco.Forms.Issues/issues/877

    Edit: A solution (and kind of a workaround) in the github issue. If you're having this issue that should solve it

Please Sign in or register to post replies

Write your reply to:

Draft