Skip to content

Radio button checked property not reset after enhanced form request #51429

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

Closed
danroth27 opened this issue Oct 17, 2023 · 1 comment · Fixed by #51796
Closed

Radio button checked property not reset after enhanced form request #51429

danroth27 opened this issue Oct 17, 2023 · 1 comment · Fixed by #51796
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Milestone

Comments

@danroth27
Copy link
Member

Repro steps:

  • Create a Blazor Web App
  • In Home.razor add:
<form data-enhance>
    <input type="radio" />
    <button>Submit</button>
</form>
  • Select the radio button and then submit the form

Expected result: The radio button is not selected after the form is submitted.
Actual result: The radio button is still selected.
Workaround: Remove data-enhance to make the form request no longer enhanced.

For comparison, if you change the input type to checkbox and do the same test, the checkbox does get unselected after submitting the form even with enhanced form handling enabled.

@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Oct 17, 2023
@MackinnonBuck MackinnonBuck added this to the 8.0.x milestone Oct 17, 2023
@MackinnonBuck MackinnonBuck added the bug This issue describes a behavior which is not expected - a bug. label Oct 17, 2023
@surayya-MS surayya-MS self-assigned this Oct 30, 2023
@AlexKovynev
Copy link

AlexKovynev commented Nov 2, 2023

@surayya-MS , @mkArtakMSFT is any chance to backport it to 8.0.x ?

mkArtakMSFT pushed a commit that referenced this issue Nov 23, 2023
# [release 8.0] Fix radio button reset after submitting enhanced form

Manual backport of #51796

## Description
This PR fixes resetting radio button checked property after submitting an enhanced form.

```html
<form data-enhance>
    <input type="radio" />
    <button>Submit</button>
</form>
```
Workaround is to remove `data-enhance` attribute.

Fixes #51429

## Customer Impact

Without this change customers will have bad experience using enhanced form that contains radio button. Radio button won't get reset after submitting the form.

## Regression?

- [ ] Yes
- [x] No

[If yes, specify the version the behavior has regressed from]

## Risk

- [ ] High
- [ ] Medium
- [x] Low

This is a minor change. We have similar logic for checkbox approved  #50991. There are unit and e2e tests for this change.

## Verification

- [x] Manual (required)
- [x] Automated

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [x] N/A

----

## When servicing release/2.1

- [ ] Make necessary changes in eng/PatchConfig.props

Fixes #51429
@mkArtakMSFT mkArtakMSFT modified the milestones: 8.0.x, 8.0.1 Nov 23, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants