Open SmarterJB opened 1 year ago
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Hello, is there a way to access (v3.12.0, DynamicForm, the onBeforeSubmit method) - all formData? I'm looking to perform advanced form validations based on all formData/submitted data and not just data from one/few changed fields.
@SmarterJB Another possibility would be to create the object with all internal field names in the dynamic form ...
I guess what I'm looking for is exactly this?
@SmarterJB ... I would be glad to implement the feature myself!
@SmarterJB, me being on my first steps on the spfx and react world, can you please give me a hint/help on how advanced validations can be performed on spfx form customizer extension (using DynamicForm - onBeforeSubmit). 🙏
Hi @b247,
I gave a code snippet here following a request about handling min / max values specified on the SP fields.
Even if there's nothing provided by the Control to handle fields validation on demand, you can always check fields values and potentially cancel form submition.
Hope that it helps.
Category
[x ] Enhancement
[ ] Bug
[ ] Question
Version
3.10.0
Expected / Desired Behavior / Question
Possibility to write error messages below each field when stopping the save in the onBeforeSubmit method. It would be nice to maybe return an object like
{"internalFieldName":"This is an error message!"}
and the dynamic form would render the message below the affected field.Another possibility would be to create the object with all internal field names in the dynamic form, and hand it over to the "onBeforeSubmit" method for the user to add an error message to each field.
This would greatly improve the usability of the dynamic form!
If we decide how it should be done, I would be glad to implement the feature myself!
Observed Behavior
Currently you can only put an error message underneath or above the whole DynamicForm.
Thanks!