Skip to content

InputSelect Component has potentially a bug. On EditForm submit (Static SSR), it causes InputText field not to databind to the model. #57350

@htmlsplash

Description

@htmlsplash

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Use Case:
Blazor .net 8
Static SSR page
EditForm submission

The "InputSelect" component has possibly a bug in it causing another field, ex InputText component failing to data bind to the model on form submit. This bug is only observed if the expression is binding using field on an inner object within the mode, Ex:

Filter 2:<InputText @bind-Value="Criteria.InnerCriteria.Filter2" class="form-control" />

Filter2 will not bind on form submit, it will be blank.

The reason for this is that InnerCriteria object has a nullable field on it (that's not even used in databinding) causing for some strange reason, InputSelect to cause InputText component to fail its databinding to a Property within the inner object. (See the InnerCriteria object for comments I added on the offending field). NOTE: This databinding problem is only on the field in the inner object that contains a nullable field declaration.

To resolve the issue, either remove the InputSelect component or better yet, edit the InnerCriteria object and change the nullable field (ThisFieldDeclarationCausesSubmitBug) to non-nullable (int? to int) and the problem is resolved. This is observed also for any nullable field.

Test repo:

https://github.com/htmlsplash/BlazorWebAppTest

Run project, select the "Criteria Test" in the nav to go to the criteria test page.
Fill out Filter 1, Filter 2 text boxes and click submit. Observe the console trace and loss of data in the form for Filter 2 field.

Expected Behavior

Both fields, in the outer and inner criteria should be bound from the form, but Fiilter 2 field doesn't bind because of the bug described above. Repo provided that reproduces the problem.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

.net 8 Blazor

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: DuplicateResolved as a duplicate of another issueStatus: Resolvedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions