Copied to clipboard

Flag this post as spam?

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


  • Matias 26 posts 67 karma points
    Apr 27, 2023 @ 08:36
    Matias
    0

    Add and remove default templates

    Hi,

    I am trying to configure the standard forms when you click Create. I would like to remove them all, and then be able to add new ones with the required fields needs.

    In Umbraco 10, the forms does not exist and neither does the js calling it (GetFormTemplates). So is there a way to configure this part?

    I was hoping of doing it like I am adding/removing fieldtypes, but is that possible or should I go another route?

    builder.WithCollectionBuilder<FieldCollectionBuilder>()
                .Add<DawaAddressField>()
                .Exclude<Umbraco.Forms.Core.Providers.FieldTypes.Recaptcha2>()
                .Exclude<Umbraco.Forms.Core.Providers.FieldTypes.Recaptcha3>()
    

    enter image description here

  • Matias 26 posts 67 karma points
    May 15, 2023 @ 06:54
    Matias
    0

    Is this not possible or could anyone point me in a direction of where to look?

  • Brian Royer 1 post 91 karma points
    Sep 27, 2023 @ 22:01
    Brian Royer
    100

    I ran into this problem as well today. But I found / figured out the solution!

    To remove the default forms from the create list - add this configuration to the appsettings.js

    "Umbraco": {
    "CMS": {
      //your cms stuff here
    },
    "Forms": {
      "FormDesign": {
        "RemoveProvidedFormTemplates": true
      }
    }
    }
    

    Then to make your own - you do it by overriding the static asset class that's built into Umbraco Forms. That static asset class can be pulled from nuget, or you can just browse it from git https://www.nuget.org/packages/Umbraco.Forms.StaticAssets/12.1.1 Choose the package explorer on the right to peruse the assets.

    You then put your own form templates in AppPlugins/UmbracoForms/Data/Templates and they will override the static assets embedded. You likely don't currently have an UmbracoForms folder in AppPlugins - you just create it for the overrides - all that stuff is now in the class.

    One thing I noticed - I tried to update the existing contactform.js - and it wouldn't override it (likely due to the name - and me hiding the built in ones via the appsettings.js) - But my new ones were recognized right away and it worked great. I just call my contact form contactusform.js and we were good to go!

    I did not find this documented - but appsettings for Forms were documented, but not the template addition/overrides (i think these work in old forms too), I guessed on that when reading the documentation for forms localization, there they discuss using the overrides of static assets to add languages - I then assumed this would work, and it did!

  • Matias 26 posts 67 karma points
    Oct 09, 2023 @ 06:45
    Matias
    1

    Hi Brian,

    That absolutely worked like a charm. Perfekt for my scenario.

    Thanks alot for your help!

Please Sign in or register to post replies

Write your reply to:

Draft