Introducing JSON Forms in Appsmith
Forms are a core part of most internal tools since its one of the major ways in which data is created or updated. Today, we're introducing the JSON Form Widget (documentation), which allows for a fantastic form creation experience and has been one of our top requested features.
The JSON form widget is helpful for quickly generating (dynamic or otherwise) forms from JSON fields.
Here are some highlights of this widget:
Generate Forms from Database Queries, APIs, or JS Objects
Once you drag a new JSON form widget, you will see a default form rendered with some details. You can update the source data field to infer data and then generate the form. This can be bound to any query or variable containing JSON data, such as DB queries, APIs, or JS Objects. The JSON Form widget can be bound to any other widget in Appsmith as well.
Auto Generate Form When Your Data Changes
The form fields are generated according to the source data when you enable an auto-generated form. Fields are generated according to the key-value pairs in the source data. Whenever there is a change in the source data, the form fields get updated automatically.
Configure Fields As You See Fit
Field configuration shows all the fields generated automatically in the forms. You can edit the fields to tweak properties like the field type and default value and bind specific actions by using editable properties. Most fields use the underlying data type-specific widget's properties to allow a full level of customization just like the widget would. For example, if the input type is text input, the editable properties are similar to the input widget in Appsmith.
Array Fields allows you to add, remove, and update a group of fields together.
Object Fields allow you to group fields together.
Add New Field, disable invalid forms (and control them further with JS), and control a widget's visibility on the app page to create highly customized dynamic forms.
Some of the ways that we've seen our users use the JSON form are:
Customer service executives select a form template and customize it for a customer. This is stored in a database and then sent over to the customer.
Users can create dynamic sign-up forms, as having both the Sign-in and Sign-up forms on the same page. Conditional switching between forms is effortless because you don't need to create two forms; you only need to change the JSON data.
Marketing teams are using the JSON form to create personalised form-based campaigns and much more!
Note: It’s live on the cloud app and will be live on the self-hosted version very soon.
Want to explore the JSON Form in detail? Head over to the JSON Form documentation page to learn more.