How do you keep track of form model changes with one way binding
See original GitHub issueI am trying to do an edit operation. Eg. I load the data for the form, set it to the model and then would like to compare the original values and the new values in OnFinish(EditContext editContext) callback using the editContext.Model (new values) when the form submitted is valid? I was thinking that I would use one way binding on the FormItem e.g.
<FormItem Label="Note"> <Input Value="@context.Note" /> </FormItem>
where my original model is loaded from the DB and set in the form as the “model” and the new updated values are in the EditContext in the OnFinish callback but I’m getting the following exception when I try one way binding. I’m not sure if this is correct
"Invalid OperationException: "Please use @bind-Value (or @bind-Values for selected components) in the control with generic type 'System.String'
Issue Analytics
- State:
- Created 7 months ago
- Comments:6 (4 by maintainers)
For the label you can set the
FormItem.Label
directly.Didn’t even realize, I didn’t have the latest release 😦. I had to fix some breaking changes e.g
RowTemplate
was Changed toColumnDefinitions
… anyway I was able to change it to oneway binding now but when the OnFinish(EditContext editContext) callback is called the editContext.Model (does NOT contain new values) from the form.I also noticed that the label that was shown before when two binding was in place from my c# model with description is not shown anymore with oneway binding.