dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.25k stars 9.96k forks source link

Cannot submit the form because no form on the page currently has that name. #54854

Closed philasmar closed 5 months ago

philasmar commented 6 months ago

Is there an existing issue for this?

Describe the bug

I am using the .NET8 Blazor Web App with Identity pages. The ExternalLogin.razor fails to submit with the following error:

Cannot submit the form 'confirmation' because no form on the page currently has that name.

This is the code snippet that causes the error:

<EditForm Model="Input" OnValidSubmit="OnValidSubmitAsync" FormName="confirmation" method="post">
    <DataAnnotationsValidator/>

    <div class="form-floating mb-3">
        <InputText @bind-Value="Input.Username" class="form-control" type="text" autocomplete="off" aria-required="true" placeholder="johndoe"/>
        <label class="form-label">Username</label>
        <ValidationMessage For="() => Input.Username"/>
    </div>
    <button type="submit" class="w-100 btn btn-lg btn-primary">Register</button>
</EditForm>

I am using the InteractiveAuto render mode. I have tried switching to InteractiveServer but that didn't help.

Expected Behavior

I should be able to submit the form.

Steps To Reproduce

Exceptions (if any)

No response

.NET Version

8.0.203

Anything else?

No response

javiercn commented 5 months ago

@philasmar thanks for contacting us.

Identity pages are not meant to be interactive. The only supported scenario for login is SSR as its the only mode where an active request is available to set the cookie.

dotnet-policy-service[bot] commented 5 months ago

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.