Closed MarvinKlein1508 closed 6 months ago
You can set Immediate
to true it will fix this behaviour for me. However I still this is a bug since normal InputText
components do not behave like this.
I'll take a look at the code you supplied.
In general, our input components don't actually change their value until focus is lost. The are wired to the @onchange event. Using Immediate changes it to use @oninput. So it does not look to be a bug per se(again, haven't looked at the code yet!). The fact that the built in components work differently does not make this a bug either. Not useful and confusing it definitely is.
@vnbaaij as far as I remember corretlcy 'InputText' uses onchange as well. But the values are present within 'OnValidSubmit'
Yes, the value is indeed present with InputText
in OnValidSubmit
. I've been debugging it, but can't find what is causing the difference. I do not have more time available to spend on this part.
You can set
Immediate
to true it will fix this behaviour for me. However I still this is a bug since normalInputText
components do not behave like this.
No, it is not a bug because InputText
works like that. We never claimed anywhere that a FluentTextField
is a drop in replacement for InputText
and (should) work(s) exactly the like it.
I'm closing this as there is a workaround available with the Immediate
option.
🐛 Bug Report
There is an error with Fluent form elements when they are being used in combination with
OnValidSubmit
. The values won't get applied to the models until the input loses it's focus.This primarly happens when you submit a form by using
Enter
when a button of type submit is present in the form💻 Repro or Code Sample
I created a short demo repository. https://github.com/MarvinKlein1508/FluentUI-Error-EditForms
When you use the button instead the values are there just as expected.
🤔 Expected Behavior
I would expect the values to be present in
OnValidSubmit
😯 Current Behavior
Values only get applied after the input loses it's focus or after
OnValidSubmit
has run.🔦 Context
This should only be relevant for any render mode besides SSR, since the form becomes posted here.
🌍 Your Environment