2011-02-02
 
Kategorie
 

Selection Options Retrieved from A Remote Source

 

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 address of the referral service that provides the list of options;
  • how the form should behave (e.g. what message should be displayed), if the remote server doesn’t respond or responds incorrectly.

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:

  • you can specify that the form should not work and the user should be presented with an error screen;
  • or you can specify that the form should work, despite the remote service being unavailable, and the user will only see a relevant message.

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:

https://myserver.com/cities?state=$state$

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:

https://myserver.com/cities?state=

- that is, for example, it returns a valid XML file with an empty option list.

 
 
recent posts
3rd Apr 2014
Faster than ever!
5th Dec 2013
Live validation!
2nd Dec 2013
Features distilled
12th Mar 2012
Flicking Channels
26th Jan 2012
Your Own Error Page
9th May 2011
Box Properties
15th Apr 2011
Grouping Fields
13th Apr 2011
Form Versioning
24th Feb 2011
Form Access Modes
22nd Feb 2011
Required Fields
4th Feb 2011
Stats!