Closed DamianEdwards closed 1 year ago
I was trying to reproduce this one in RC1. Then I saw "RTM" and who posted it 😂 I didn't get that message though. The handler executed, but the parameters are not bound.
So the behavior is supposed to have changed? And there is a bug as well?
I get confused because I'm used to FormEdit
and supplying a Model
. I apply the [SupplyParameterFromForm]
to the field or property containing that model object.
In RC1, in order for the parameters to be bound for plain HTML form elements, you need to supply a name
matching the path in the model. Such as ItemName
, Item.Id
, or Model.Id
.
<input type="hidden" name="ItemId" value="@item.Id" />
<input type="hidden" name="ItemName" value="@item.Name" />
After further investigation I've determined this only repros if the form contains a Razor expression nested in an HTML element, nested within the <form>
body. The repro code above has this (the <strong>@item.Name</strong>
) so you should be able to see the error with that code.
@marinasundstrom thanks, I've updated the repro code to include the names on the fields to avoid confusion, although it's not strictly related to reproducing this issue.
Thanks Damian. Closing as a dupe of https://github.com/dotnet/razor/issues/9323
Found when updating an app from an rc.2 build to latest rtm build.
Info
SDK version:
8.0.100-rtm.23471.13
Repro
Update the Home.razor to the following:
Expected
The form can be submitted successfully and the form handler runs.
Actual
An error message is shown in the browser: