awesome-inc / NZazu

NZazu, a wpf templating engine to create a dynamic form for user input.
4 stars 5 forks source link

"This field is required" Error-Message doesn't tell you which field is required #95

Closed wgnf closed 2 years ago

wgnf commented 5 years ago

When a field is marked as required, like so:


{
                "Key": "email",
                "Type": "string",
                "Prompt": "Email",
                "Description": "Email address",
                "Checks": [
                  {
                    "Type": "required"
                  }
                ]
}

And the template get's validated, an error with the message This field is required will be thrown.

The Message points to a field (this), but there's no information about the field! There should be an information (just the name) about the affected field, like: This field is required: {field} This should be the case for all fields and also other controls (e.g. columns in datatables)

If no information like this is given, an editor, that has no access to the JSON-representation of the template, doesn't know which field he's missing out.

wgnf commented 5 years ago

Somehow the ValidationResult should receive or have information regarding the Field that is validated, so that users that are using the NZazuView.Validate() method can receive such information.

The way that i have in my mind currently, is to pass in a new parameter into the IValueCheck.Validate() Function for the fieldname (key). But that would require a lot of changes.

Is there a cleaner way?

mkoertgen commented 5 years ago

@DatMaddin Usually wpf-validation is used to support visual adorners, i.e. adding a visual cue for the user on the field that failed during validation (see examples). So the adorner should highlight the validation error at the corresponding field telling you exactly what field failed the RequiredValidation.

Maybe, i am missing something here. Is there a proper use case for using NZazuView.Validate() programmatically? Is this an NZazuFiddle issue, i.e. inproper binding of binding validation errors to the view?

mkoertgen commented 5 years ago

@DatMaddin Also for the other issues you opened: Try to provide user value/context. What is the user trying to achieve? Where does this issue raise?

@htochenhagen @janbo485 Probably GitHub Issue Templates would be a good idea on enhancing guidance on the repository.

wgnf commented 5 years ago

@mkoertgen I will have a look on a visual feedback, that you mentioned, thanks.

We're using the Validate() function to check if everything is ok with a given view before saving the values to the database. And that's not a NZazuFiddle issue.

mkoertgen commented 5 years ago

Ah, i see. Probably you are using one thing for two purposes. Check back with @ThomasLey on this. He should be able to give some guidance on this.

Happy coding!