Blogs > Submitting Adaptive Form using Form Data Model

AEM Forms

Submitting Adaptive Form using Form Data Model

Infodales Tech Solutions | February 28, 2023

This blog will help you understand how to connect a database to your AEM adaptive forms to retrieve and insert form values. When integrating Adaptive Forms with a Database, establishing seamless connections to data sources becomes essential for retrieving customer data during form rendering. Various scenarios may require data retrieval from these sources based on user inputs within Adaptive Forms. Additionally, upon submitting an Adaptive Form to a database, the captured data can be efficiently updated back into the corresponding data sources.

We are going to achieve below flow as a part of this blog

  • Setting up Database in this case its MySQL.

  • Creating Form Data Model

  • Submitting Form to the Database using Form data model

form-data-model-flow

Setting up Database

Go to the official website to download the bundle of your respective database in this case it is MySQL. Click the highlighted link and your bundle get's downloaded.

Now got to the http://localhost:4502/system/console/bundles and upload the bundle.

After uploading the bundle if it appears in system/console/bundles then it has successfully uploaded.

After successfully installing the respective database connector you then need to create database so that whatever form you submit, that needs to be submitted to the created database. In this we're creating a database name . After creating a database, a configuration needs to be done so that our form model knows in which database he need to submit the data.

  • In Datasource name you can provide any name that you wanted to keep.

  • In JDBC Driver class you need to provide the driver class of your respective database.

  • In JDBC Connection URL you need to provide the url of database and proper database name as well.

  • Then click on save and your configuration is done.

Creating Form Data Model

  • To create a form data model go to forms.

  • Then click on data integrations.

  • Then click on create option.

  • Inside that you will see form data model option click on it.

  • After clicking on it, add the title for form data model and click on next.

  • Then select the data source which you configured in data pooled configuration.

  • And your form data model is created

    • After creating the form data model you need to do the required configuration. First you need to add the services GET,INSERT and UPDATE and after adding the services and database you need to test the individual service. After that you need to configure the default services you need for the form data model in this we configured GET,Insert this needs to configured because whenever you create a form your form uses this defualt services to submit the data in to the database.

Submitting Form to the Database using Form data model

To submit form using form data model we need to follow the below steps:

  • We need to create an adpative form.

  • While creating an adaptive form we need to select the proper form data model which we created.

  • After creating form we need to map the fields of form with data model fields so that proper data gets submitted to respective fields in database.

  • Need to map submit button with form data model this confiuration is done when we edit the button in submissions we need to select submission type in that we need to select form data model below that we need to provide the form data model endpoint.

  • After this your form is ready when you fill the data and submit the form it will get submitted to the database.


I hope you find this informative and helpful.


Owais Pathan | AEM Developer
LinkedIn Email