Repository navigation
EditForm: change API to allow form subission from code #48613
Description
Activity
- ghost addedneeds-area-labelUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automaticallyUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically
on Jun 5, 2023 - addedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsand removedneeds-area-labelUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automaticallyUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically
on Jun 5, 2023 To clarify, did you try triggering your own submit handler directly? That is, whatever method is wired up to the form - could you just call it manually? If your goal is to run validation, you can also run
yourEditForm.EditContext.Validate()directly.I'm asking to clarify whether there is some particular thing that can't be achieved this way, or whether it's just that you're looking for a more convenient built-in mechanism.
- addedNeeds: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.
on Jun 5, 2023 Yes, we're doing as you suggested: calling the validate and then calling the handler but it kind of breaks the flow, no? why can't we have a public submit method on the EditForm?
- ghost addedNeeds: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.
on Jun 5, 2023 - ghost removedNeeds: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.
on Jun 5, 2023 Sure, that's a totally reasonable request. I was only asking to clarify if an alternative existed and to make sure I wasn't missing something about what exactly you would expect the submit method to do.
- removedNeeds: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.
on Jun 6, 2023 I've moved this to backlog because we already have a full work schedule for .NET 8. However if you are keen enough to implement this and do a PR (including E2E tests) we would certainly consider taking it.
Just to add: this should probably work by making a JS interop call to instruct the browser to submit the form (instead of just invoking the .NET handler). That way any other expected client-side behaviors, such as triggering HTML's built-in validation prompts, should also occur.
- addedpending-ci-rerunWhen assigned to a PR indicates that the CI checks should be rerunWhen assigned to a PR indicates that the CI checks should be rerun
on Feb 6, 2024 - removedpending-ci-rerunWhen assigned to a PR indicates that the CI checks should be rerunWhen assigned to a PR indicates that the CI checks should be rerun
on Feb 6, 2024 - addedpending-ci-rerunWhen assigned to a PR indicates that the CI checks should be rerunWhen assigned to a PR indicates that the CI checks should be rerun
on Feb 6, 2024 - removedpending-ci-rerunWhen assigned to a PR indicates that the CI checks should be rerunWhen assigned to a PR indicates that the CI checks should be rerun
on Feb 13, 2024 - addedhelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issueand removed
on Jan 7, 2026
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
Currentyle, it seems there's no way to submit an EditForm programatically from C# code because the HandleSubmitAsync method is private.
Describe the solution you'd like
Adding a public method that submits the form would allows us to have forms without submit buttons (ex.: scenario where the user must pick items from lists and where picking an item should submit a form) and would allow us to reuse the context+validation logic currently implemented by the EditForm.
Additional context
No response