plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
482 stars 657 forks source link

Volto's form validation is severely limited #4415

Open tiberiuichim opened 1 year ago

tiberiuichim commented 1 year ago

The form validation is hardcoded. The only way to add new validators in a form is either by declaring a new widget or type and patching widgetValidation.

Ravi-kumar9347 commented 11 months ago

Hey @tiberiuichim can you explain the issue in some detail ?

erral commented 11 months ago

The form validation is hardcoded. The only way to add new validators in a form is either by declaring a new widget or type and patching widgetValidation.

In an on-going non-Volto project, we are using react-jsonschema-form to render and validate forms, and it works pretty well. We took the idea of rendering JSONSchema based forms from Volto.

I know that Volto renders the forms using custom widgets, but perhaps using a library like this, can bring validators 'for free'.

I know that modifying Volto to use a library like this is a larger project than adding proper validator support, and may be even unachievable, but it may be interesting.

ericof commented 5 months ago

I just discussed with @sneridagh and one possible (even if limited) solution would be to move widgetValidation to the configuration registry and allow people to register new validations (if needed).