The ActiveForms engine version 3.6 and higher allows us to configure forms where selection options can be generated dynamically on an external server. To do so, go to the Properties of a drop-down list, a radio button, a checkbox list, or a multichoice control, select Option list: synchronized with external source and specify:
The entered address must point to an existing service that will return a list of options as:
<?xml version="1.0" encoding="UTF-8"?> <select xmlns="http://referenceservices.activeforms.com/1.0"> <option value="AAA" label="Aaa"/> <option value="BBB" label="Bbb"/> <option value="CCC" label="Ccc"/> </select>
The list of options for such a field will be generated each time a user enters the form.
While configuring such a field, the administrator can specify how the system should behave when the remote source of options is not operational. In such a situation:
The address used to access the service can contain codes (identifiers) of fields whose value will be substituted with the current value while sending the request. For example, a request for a list of districts could look as follows:
Assuming that the form contains a field with the street_address_province code, and the field contains a correct list of Polish provinces, you could expect to receive a list of districts for the preselected province in the configured field.
Such option lists are generated (retrieved from a remote server) whenever the value of a field whose code is included in the address changes.
The lists are also retrieved for all fields with remote option lists when the form is launched. That is why you should also ensure that the service which generates the options behaves correctly when a passed parameter is empty. In the above example, you should ensure the service responds correctly to the following request:
- that is, for example, it returns a valid XML file with an empty option list.