Copied to clipboard

Flag this post as spam?

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


  • marcelh 171 posts 471 karma points
    Sep 07, 2017 @ 07:33
    marcelh
    0

    Applying a theme using the Form Picker

    I just upgraded my Umbraco Forms installation to version 6.0.2. Instead of using the macro to insert a form, the Form Picker datatype is used.

    How am I able to apply a Theme (other than the default) to a picked form?

  • marcelh 171 posts 471 karma points
    Sep 07, 2017 @ 08:20
    marcelh
    100

    Ok, got it, here's the trick:

    Html.RenderAction("RenderForm", "UmbracoForms", new { formId = Model.Content.Form, theme = "my-fantastic-theme" })
    

    Note the difference between the action method Render, and RenderForm. The latter is newer one that takes the theme as parameter and uses the new Themes folder structure (from ˜/Views/Partials/Forms/Themes). The (obsolete?) Render ignores the theme parameter and renders the form using the (older) partials (from ˜/Views/Partials/Forms using the Form.cshtml and fieldtypesz from the FieldTypes folder).

  • Brittany Dufort 4 posts 25 karma points
    Jan 30, 2018 @ 18:01
    Brittany Dufort
    1

    For all the Googlers out there like me - I want to provide an update for applying a theme to a form.

    @Umbraco.RenderMacro("renderUmbracoForm", new { FormGuid = Model.Content.GetPropertyValue("form"), FormTheme = "signup" })
    

    Where renderUmbracoForm is the alias of InsertUmbracoFormWithTheme macro (by default, although you can change this in the back office under Developer/Macros).

    To set a theme, add the macro parameter FormTheme and set it equal to the folder name under Views/Partials/Forms/{{themeName}} (which mine was named signup).

    Just as an added bit of info - you only need to include the files under your theme folder that you wish to overwrite.

Please Sign in or register to post replies

Write your reply to:

Draft