RadzenTemplateForm Reset does not clear bound data variables #1699

Closed
opened 2026-01-29 17:57:26 +00:00 by claunia · 1 comment
Owner

Originally created by @Anspitzen on GitHub (Apr 2, 2025).

Describe the bug
Clicking on Reset button in a RadzenTemplateForm does clear only the display, not the bound data inside the FormComponent

To Reproduce
Steps to reproduce the behavior:

  1. Go to demo pages
  2. Replace the source with:
<RadzenTemplateForm TItem="string" Data="_nameOrTitle" Submit="LoadData">
    <RadzenFormField Text="Name or Title">
        <RadzenTextBox @bind-Value=@_nameOrTitle Placeholder="Name or Title" />
    </RadzenFormField>
    <RadzenButton ButtonType="ButtonType.Submit" Text="Submit" />
    <RadzenButton ButtonType="ButtonType.Reset" Text="Reset" Click="Reset" />
</RadzenTemplateForm>

<EventConsole @ref=@console />

@code {
    EventConsole console;
    string _nameOrTitle;

    void LoadData(string text)
    {
        console.Log($"Submit with: {text}");
    }

    void Reset()
    {
        console.Log($"Reset, now in bound variable: {_nameOrTitle}");
    }
}
  1. Type something in the textbox
  2. Click on the Reset button

Expected behavior
On click on button the console should display the message without any text in the variable. (Reset, now in bound variable: )

Desktop (please complete the following information):

  • Browser Chrome
Originally created by @Anspitzen on GitHub (Apr 2, 2025). **Describe the bug** Clicking on Reset button in a RadzenTemplateForm does clear only the display, not the bound data inside the FormComponent **To Reproduce** Steps to reproduce the behavior: 1. Go to [demo pages](https://blazor.radzen.com/templateform?theme=material3) 2. Replace the source with: ``` <RadzenTemplateForm TItem="string" Data="_nameOrTitle" Submit="LoadData"> <RadzenFormField Text="Name or Title"> <RadzenTextBox @bind-Value=@_nameOrTitle Placeholder="Name or Title" /> </RadzenFormField> <RadzenButton ButtonType="ButtonType.Submit" Text="Submit" /> <RadzenButton ButtonType="ButtonType.Reset" Text="Reset" Click="Reset" /> </RadzenTemplateForm> <EventConsole @ref=@console /> @code { EventConsole console; string _nameOrTitle; void LoadData(string text) { console.Log($"Submit with: {text}"); } void Reset() { console.Log($"Reset, now in bound variable: {_nameOrTitle}"); } } ``` 3. Type something in the textbox 4. Click on the Reset button **Expected behavior** On click on button the console should display the message without any text in the variable. (Reset, now in bound variable: ) **Desktop (please complete the following information):** - Browser Chrome
Author
Owner

@akorchev commented on GitHub (Apr 2, 2025):

Hi @Anspitzen,

I think this is caused by Blazor itself. It doesn't handle form resets. Here is a related issue: https://github.com/dotnet/aspnetcore/issues/21179

@akorchev commented on GitHub (Apr 2, 2025): Hi @Anspitzen, I think this is caused by Blazor itself. It doesn't handle form resets. Here is a related issue: https://github.com/dotnet/aspnetcore/issues/21179
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1699