Formless fields
See original GitHub issueWhat
Need to consider a formless usage of field components.
Why
Right now when a field component is rendered and is unable to find any ancestor Form, it will throw an error during the record registration. This may be confusing for the beginning developers.
However, it is also reasonable to insist to wrap fields in Form
. Fields compose a form, so there must be a form. This suggestion requires discussion.
Specification
- General statements.
a) A field is considered formless when it doesn’t have a wrapping
<Form>
component. - Technical statements.
a) A formless field cannot access
fields
andform
within any callback/handler methods. b) A formless field cannot accessfields
andform
in any validation resolvers. c) A formless field behaves as a plaininput
field. That implies, it is uncontrolled by default, and can be made controlled by providing avalue
prop and a change handler function. d) (???) A formless field can still accept field enhancers. e) A formless field doesn’t benefit from any form behaviors (serialization, validation, etc.).
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
The Formless Field of Benefaction - Tricycle
While Buddhist history is steeped in monasticism, our own democratic traditions compel us to share the burden of social problems. The challenge now...
Read more >purescript-halogen-formless
Formless is a renderless component to help you build forms in Halogen. This module re-exports all ... Validate all fields in the form,...
Read more >A Formless Field of Benefaction - Zen Mountain Monastery
A formless field of benefaction. I wear the Tathagatha's teaching. Saving all sentient beings. Referencing the words of Master Dogen, Shugen Roshi ...
Read more >Formless designs, themes, templates and ... - Dribbble
Discover 8 Formless designs on Dribbble. ... Formless Arts formless geometry line logo motion ... Formless Fields logo blog design logo.
Read more >Ahead, the formless field by Mary-Kim Arnold - Tupelo Quarterly
Ahead, the formless field by Mary-Kim Arnold. November 14, 2020 in Collaborative and Cross-Disciplinary Texts tagged Mary-Kim Arnold by Kristina Marie ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, @nickensoul. Thanks for the kind words! Let me update you.
Technical background
The biggest task here is to replace the
Form
as the event source hub. At the moment theForm
component establishes per-instance event emitter, and subscribes to certain events with handlers. Field component wrapped increateField
communicates back to the parent Form via form’s event emitter to propagate such events as mounting/unmounting, value change, focus, or blur.I would say that from the technical perspective a solution to support formless fields is somewhat clear. It would be good to implement (or prepare for) formless fields under #324. I’m currently working on #354, which improves event handlers that would grant less control to the Form, and more to the events.
What now?
I understand both a desire to use a form element without a wrapping Form, and a conceptual idea behind a form input (to gather data for a form). Nevertheless, I still think that formless fields is worth implementing, but I would also encourage developers to expect less functionality from a formless field.
This implementation is on the roadmap, but I would put #324 and #232 as the highest priority.
Functionality limitations
FormProvider
, or via custom HOC (to be discussed)Update
It has just occurred to me, that it is possible to understand whether the field is formless on the
createField
high-order component level.That way, in case of formless fields, HOC could act as a field’s state accumulator, a replacement for Form in terms of field-form communication. This way field component remains as is, it keeps communicating up as is, as if there is always a form. Instead,
createField
HOC gets smarter in case of formless fields.