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 2 3 | |
Write the Form Configuration#
For the Form Configuration we need to write 2 lists:
- fields: a list of the fields you want to customise (using the Field Configuration format); a field which loads its options from a remote url needs a Field Configuration;
- rules: a list of Update Rules, which tell the Observers to update when a Subject changes, usually on a
changeevent (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 need to specify a Field Configuration for field_one: it is discovered automatically.
Create the form#
Create the form 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.