Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormPrePopulateNotification - file upload doesn't work #1317

Open
nexwork-percy opened this issue Nov 15, 2024 · 0 comments
Open

FormPrePopulateNotification - file upload doesn't work #1317

nexwork-percy opened this issue Nov 15, 2024 · 0 comments
Labels
state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/bug

Comments

@nexwork-percy
Copy link

nexwork-percy commented Nov 15, 2024

When you register even a dummy, empty FormPrePopulateNotification handler, any form with a File Upload will not work.

Reproduction

Setup a new empty project

dotnet new -i Umbraco.Templates::13.5.2
dotnet new umbraco -n "FormsPrePopulateBug"
dotnet new sln -n FormsPrePopulateBug
dotnet sln add .\FormsPrePopulateBug\FormsPrePopulateBug.csproj
dotnet add Umbraco.Forms::13.3.0

Add a FormPrePopulateNotificationHandler

public class FormsComposer : IComposer
{
    /// <summary>
    /// Register event handlers for Umbraco Forms.
    /// <see href="https://docs.umbraco.com/umbraco-forms/developer/extending/adding-an-event-handler" />
    /// </summary>
    /// <param name="builder"></param>
    public void Compose(IUmbracoBuilder builder)
    {
        builder.AddNotificationHandler<FormPrePopulateNotification, FormsPrePopulateNotificationHandler>();
    }
}

public class FormsPrePopulateNotificationHandler : INotificationHandler<FormPrePopulateNotification>
{
    public void Handle(FormPrePopulateNotification notification)
    {
        // Empty
    }
}

Create a form and name it 'Test Form' with a File Picker.
Create a doctype and name it 'Home', allow Root, add a Form Picker and name it 'A Form', and allow the 'Test Form' to be picked.
Home can have a very simple template:

@using Umbraco.Cms.Web.Common.PublishedModels;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.Home>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@{
	Layout = null;
}

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

Specifics

Using Umbraco 13.5.2
Umbraco.Forms 13.3.0

When commented out the line builder.AddNotificationHandler<FormPrePopulateNotification, FormsPrePopulateNotificationHandler>();, the File Upload works.

When not commented out, the file upload does not work.

Expected result

Form Entry contains the uploaded file.

Actual result

Form Entry does not contain the uploaded file.


This item has been added to our backlog AB#46015

@AndyButland AndyButland added type/bug state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks labels Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/bug
Projects
None yet
Development

No branches or pull requests

2 participants