-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]: Is there any way I can find out which fields were valid and which were not? #201
Comments
Hi @john-dalsgaard, The idea of validation itself. is that it prevent you from taking further actions if data is not valid. @inject SomeService SomeService
@code
{
void StoreValidItems(Foo item)
{
// Use the instance to validate. (Might need a validator for each item)
bool IsValidFoo = new FooValidator().Validate(item).IsValid;
// If Item is valid, Add it to your DI injected Service. Else? Ignore it!
if(IsValidFoo) SomeService.ValidItems.Add(this);
}
} IMPORTANT NOTE!Use
|
Thanks for your reply. I do agree on the standard way of treating validation. As this is a survey where the user is allowed to go back and forth we do want to help storing the valid values if navigating back to a former subject and then return to the same page later. The way I have set up validation at the moment is like this:
This is the current "compromise" where In the above setup I don't use Dependency Injection. I cannot call the Well, I have a working solution now - so it is not a major issue any more... I was just wondering |
I would like to save the valid fields on navigation as we allow the user to go back (and not be stuck) but would like to keep the data that is valid for when the user returns to the page.
I have tried a number of things like trying to read the validation messages:
or
But no success... Have I overlooked something?
Thanks in advance.
/John
The text was updated successfully, but these errors were encountered: