-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Summary
Currently, AEM Core Forms Components largely handle component values in the underlying form model as simple string types. This feature request suggests enhancing the form model and component architecture to natively support JSON objects as component values. This change would allow a single component to represent and manage a complex data structure—like an object with multiple properties or an array of objects—instead of being limited to a single string.
Problem Statement
When building components that naturally group related data points (such as an address block with street, city, state, and zip; a list of items; or a user profile with name, email, and phone), developers currently face a few challenges:
- Creating multiple individual form fields: This results in a flatter form model, more separate form submissions, and makes it more difficult to manage related data as a unified whole.
- Manually serializing/deserializing JSON to/from a string: This requires custom JavaScript on the client-side and potentially custom Sling Model/Java logic on the server-side. This converts complex data structures into a single string for storage, and then parses them back when the form loads. This process adds development overhead, increases the chance of errors, and makes components less "smart" about their own data.
- Relying on custom Sling Models and form submission handlers: While effective, this approach shifts complexity away from the component itself and into backend logic. This makes the component less self-contained and less reusable.
This limitation prevents the creation of truly composable and intelligent form components that can effectively manage their own internal state.