Hi,
I'm trying to create a tool where there are several select parameters
whose choices are determine by the previous parameter(s). I have a toy
example with three parameters: Category, Food, and Prep method.
Depending on the chosen Category, only certain Foods are shown, which in
turn determines which Prep methods are available.
I'm trying to use the <options> tag with the "from_file" attribute. I
have one column per parameter and one row per valid combination.
My problem is that the front end can get into a state where a certain
valid combinations will be unselectable. In the example below, I can
never select "Fruit", "Kiwi", and "Raw". When I change the 1st select,
the values for the 2nd select are loaded, but the values for the 3rd
select cannot be updated. This is particularly problematic if there is
only one choice for the 2nd select, because I cannot get it's "onchange"
handler to fire (so the 3rd select is always empty).
In my case, it would be nice if the first value of the 2nd select is
chosen as a default, and the 3rd select is populated accordingly.
Any help would be appreciated. Perhaps I'm not using these features as
intended, but it seemed like a natural application.
Thanks,
Josh
My data file looks like:
Meat Chicken Fried
Meat Chicken Grilled
Meat Beef Grilled
Meat Beef Stir-fried
Veg Carrot Boiled
Veg Fennel Raw
Fruit Kiwi Raw
And my tool's <inputs> section is:
<inputs>
<param name="paramA" type="select" label="Category">
<options from_file="test_select_options.txt">
<column name="value" index="0"/>
<column name="name" index="0"/>
<filter type="unique_value" name="unique" column="0"/>
</options>
</param>
<param name="paramB" type="select" label="Food" >
<options from_file="test_select_options.txt">
<column name="value" index="1"/>
<column name="name" index="1"/>
<filter type="unique_value" name="unique" column="1"/>
<filter type="param_value" ref="paramA" name="A" column="0"/>
</options>
</param>
<param name="paramC" type="select" label="How prepared">
<options from_file="test_select_options.txt">
<column name="value" index="2"/>
<column name="name" index="2"/>
<filter type="param_value" ref="paramA" name="A" column="0"/>
<filter type="param_value" ref="paramB" name="B" column="1"/>
</options>
</param>
</inputs>