Closed joshhanson314 closed 9 months ago
Thanks for contacting us.
We're moving this issue to the .NET 8 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
in the meantime, this seems to suit my needs. It should go without saying that it is bad to use reflection to access private fields of base classes, but this seems to be my only alternative.
`protected override void Dispose(bool disposing) { base.Dispose(disposing);
var type = GetType();
var fieldInfo = default(FieldInfo);
while (type != null)
{
fieldInfo = type.GetField("_parsingValidationMessages", BindingFlags.Instance | BindingFlags.NonPublic);
if (fieldInfo != null)
break;
type = type.BaseType;
}
if (fieldInfo?.GetValue(this) is ValidationMessageStore validationMessageStore)
{
validationMessageStore.Clear();
EditContext?.NotifyValidationStateChanged();
}
}`
Hello, we experienced a similar issue. If you have an EditForm with an input number with a randomized key and you enter an invalid value (e.g. you enter "0e"), the next valid value is evaluated as invalid.
<EditForm EditContext="amountEditContext" OnSubmit="@Submit">
<DataAnnotationsValidator />
<InputNumber @key="Guid.NewGuid()" @bind-Value="model!.Amount" />
<button @onclick="Submit">Submit</button>
</EditForm>
@code {
private EditContext amountEditContext;
private BasketModel model = new();
protected override void OnInitialized()
{
amountEditContext = new(model);
}
private void Submit()
{
if (amountEditContext.Validate())
{
Console.WriteLine("Submitted");
}
}
public class BasketModel
{
public int Amount { get; set; }
}
}
Thanks for contacting us.
We're moving this issue to the .NET 9 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
Thanks for contacting us.
We're moving this issue to the .NET 9 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
I have a dynamic form, where i can add/remove fields which are displayed.
If i have an validation messages for a field, and then the field is removed from the page (the input component is disposed) the validation messages stay. I feel like the
Dispose()
https://github.com/dotnet/aspnetcore/blob/231db98e76787b120d2a13fda53b8623f7137b01/src/Components/Web/src/Forms/InputBase.cs#L316 onInputBase
should call_parsingValidationMessages.Clear()
This prevents my submit from working since the EditContext thinks my form has validations.. well it did but I removed the field..
Originally posted by @Zoxive in https://github.com/dotnet/aspnetcore/issues/24563#issuecomment-778681586