Add Custom Validation Messages to DataForm

Hi Team Synfusion,

We're trying to implement the DataForm control, and everything is working well and intended.  There is one problem that we have found, however, and need guidance.

Consider the following scenario:

  1. DataForm is bound to model
  2. Data is submitted to server (API)
  3. API throws error and/or validation errors (400 code)
In the case of validation errors, they are returning as 400 (bad request) responses from the API, and take the form of ProblemDetails as defined by Refit:

Example of a ProblemDetails (JSON):
```

{"type":"https://tools.ietf.org/html/rfc9110#section-15.5.1","title":"One or more validation errors occurred.","status":400,"errors":{"Name":["Please enter your first name"]},"traceId":"00-000-00"}

```
The question is this:
How do we elevate these errors to the user interface of the DataForm?  Is there a way to add custom error/validation messages so that the DataForm displays these errors and highlights the generated control that has the validation issue?

Thank you for any assistance you can provide.

3 Replies 1 reply marked as answer

AJ Arul Jenith Berkmans Syncfusion Team June 18, 2025 03:26 PM UTC

Hi Mike,

 

We are currently reviewing your query and preparing a sample from our end. We will provide you with an update within two business days (by June 20, 2025).

 

In the meantime, you may find the following documentation helpful regarding validation messages: Data validation in .NET MAUI DataForm control | Syncfusion<sup>®</sup>
 

Thank you for your patience and understanding.

 

Best regards,

Arul Jenith B.



MI Mike-E June 19, 2025 03:02 PM UTC

Hi Arul,


Thank you so very much for your assistance.  Please be aware that I used Grok to help figure this out:

Highlighting Validation Errors in Syncfusion .NET MAUI DataForm | Shared Grok Conversation


I have encapsulated this in a Behavior here:

https://github.com/DragonSpark/Framework/blob/client/b/DragonSpark.Application.Mobile.Maui/Presentation/Behaviors/Validation/DataFormValidationErrorMonitorBehavior.cs


So, I no longer need assistance with this here, but feel free to share further code for others who may be running into the same issue if you feel you have something further to add.


Thank you again for all your great assistance and support, it is greatly appreciated!


Marked as answer

AJ Arul Jenith Berkmans Syncfusion Team June 20, 2025 10:47 AM UTC

Hi Mike-E,

 

We're glad to hear that you were able to resolve the issue with the help of Grok and your implementation. Your willingness to share your solution for the benefit of others is greatly appreciated.

 

If you have any more questions in the future or need further assistance, please don’t hesitate to reach out.

 

Best regards,

Arul Jenith B.


Loader.
Up arrow icon