dotnet / dotnet/aspnetcore

InputSelect with int values does not populate on validation error and doesn't work as expected.

Open
#54,127 2 comments 0 reactions 0 assignees View on GitHub
area-blazor bug feature-blazor-builtin-components feature-model-binding
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

```

Month
1 - Jan
2 - Feb
3 - Mar
4 - Apr
5 - May
6 - Jun
7 - Jul
8 - Aug
9 - Sep
10 - Oct
11 - Nov
12 - Dec

.... other input with validation error
```

When submitting the form with validation errors, the model of the select will not be persisted/populated because the value is a string and the Model.Month is an int.

This works:
```

Month
1 - Jan
2 - Feb
3 - Mar
4 - Apr
...

```

### Expected Behavior

The value should be persisted

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

8.0.2

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.