newforms icon indicating copy to clipboard operation
newforms copied to clipboard

What is your favorite react form implementation?

Open luqin opened this issue 9 years ago • 4 comments

From the top of my head:

  • newforms
    • actively maintained
    • isomorphic
    • predefined validators and widgets
    • async validations out of the box

gcanti avatar May 07 '15 05:05 gcanti

The core design of newforms is still that of django.forms, so it's currently more suitable for fairly static CRUD-like editing which uses the provided widgets than highly-dynamic forms with custom React widgets. For example a notable feature which is missing is the ability to easily change a field's configuration on the fly (e.g. dynamic choices for dropdowns, chained inputs, dynamic disabling, dynamic visibility management).

Since the rendering use case for Django forms is "render to HTML and done", its core design never need to take into account mutable, dynamic forms, which is what you get with React on the client side. As such, features like onChange validation and async validation were lumped on top of this and rendering at the field level is managed by regular JavaScript objects which output ReactElements, rather than React components, which makes it trickier to implement custom widgets than it would otherwise be.

My feeling is increasingly that you should evaluate how React form libraries work and move on to the next one or write your own form-handling if you have very specific needs which they don't obviously cater to. There are so many decisions to be made at each step of implementing reusable form validation that it's unlikely any form library will cover everything exactly the way you want it, or give you all the control you need to customise each piece.

insin avatar May 07 '15 08:05 insin

@gcanti are you saying you like newforms better than your own tcomb-forms?

marr avatar May 15 '15 22:05 marr

As @insin wisely says:

There are so many decisions to be made at each step of implementing reusable form validation that it's unlikely any form library will cover everything exactly the way you want it

I don't like tcomb-form, I just need its features.

gcanti avatar May 16 '15 04:05 gcanti