Problem Statement
| English |
|---|
In this article, we will discuss how to create a new form by performing a lookup into the existing table inside the Joget database. If the existing table has a sizeable number of fields (ie. 50 fields), it would take some time to drag and drop each and every form element into a new form. This is the sample table structure used in creating the demo app. |
| Code Block |
|---|
| language | sql |
|---|
| linenumbers | true |
|---|
|
mysql> describe custom_table \G
*************************** 1. row ***************************
Field: id
Type: varchar(255)
Null: NO
Key: PRI
Default: NULL
Extra:
*************************** 2. row ***************************
Field: name
Type: varchar(255)
Null: YES
Key:
Default: NULL
Extra:
*************************** 3. row ***************************
Field: address
Type: varchar(255)
Null: YES
Key:
Default: NULL
Extra:
3 rows in set (0.00 sec)
mysql>
|
...
- Key in the custom table name into the text field.
- Click Generate
Image Modified
Figure 1: Screenshot Showing Form Definition Generated from the Custom Table Name - With the form definition generated, copy its content.
- Create a new form or open any existing form.

Figure 2: Create New Form - In the form builder, go to Form Builder > Advanced Tools > JSON Definition, paste the definition earlier, then click Update.

Figure 3: Paste JSON Definition of the Form into Form Builder - Verify the form design, then click Save.
Image Modified
Figure 4: Form Design from the Generate JSON Definition.
...
In line 27, you can modify to use other form element other than textfield depending on your needs.
Download Demo App
| View file |
|---|
| name | APP_generateFormDef-1-20211011154430.jwa |
|---|
| height | 250 |
|---|
|