Hello,

I would like to have a tool form with a two parameters:

1. Select State
2. Select Town

The options for 'Select State' are dynamically generated with dynamic_options which calls a python function, which connects to a database and returns the list of States. This works fine in my form xml code:

<param name = "State_id" type="select" dynamic_options="getStates()" label="Select State" display="radio" multiple="false">

Now I want to dynamically create the options for '2. Select Town'. To make this work I need to take the selected option from '1. Select State', pass it as an argument to a dynamic_options function call that would then connect to a database and retrieve the Towns for the provided State. These Towns would then be the options for '2. Select Town'. So, the second parameter '2. Select Town' should do something like this:

<param name = "Town_id" type="select" dynamic_options="getTowns([user selected value in 1. Select State])" label="Select Town" display="radio" multiple="false">

The part in square brackets is pseudo code; this is the part that I cannot get to work . That part should also be automatically refreshed if the user changes the selection in '1. Select State'.

I looked into the use of <conditional> but I don't see how I can use that if I don't know beforehand what values I can have (determined in real time based on content of database), so I cannot code the <when> tags. 

Any help is greatly appreciated.

Thank you in advance,

Hans