Tutorial - Form creation#
Preconditions#
Did you already installed and loaded the library? Then go on, you are almost there!
Let's assume we are working on the following html form:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Let's assume we loaded dynamic-forms using a CDN:
1 |
|
Write form configuration#
For the form configuration we need to write 2 lists:
- fields: a list of form fields with custom behavior (using the field configuration format); a field with a remote url for fetching its values is a custom behavior field;
- rules: a list which indicates when a field related event (usually a
change
) should notify other fields (using the update rule format)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Note: we didn't specify field_one
's configuration.
Create the dynamic form#
Create an instance and forget about it: dynamic-forms will work by itself!
1 |
|
Done!#
Look at the network tab in developer console/tools while you play with your form!
Of course you need a real api-endpoint to load your values. For a working example open files in the example folder in your browser.
This is a basic configuration which works with default values. To customize it to your needs check the documentation chapter.