FX Dependent Js Menu - (by Felice Di Stefano)

This object will create a set of multilevel dependent lists or menus in a client-side script style and no recordset will becreatedbut it will relay on a recordset previously created. Multilevel because it is not restricted to a single pair of dropdown lists but it may include a chain of dependences with more than 2 list/menu, in the chain in can be included optionally also textareas as last elements depending from the same list. But this is not all because it may be able to create multiple dependence sets at one time and with no restriction of form dependence. That is, you may create a pair and then another pair at the same time.

Applying

Before opening the object you must have at least a form on the page with all the required elements empty and named and at least one recordset to which the lists will be linked, it doesn't matter if you have on the form(s) more elements than what you require. Example, if you intend to create a dependent pair of dropdowns, you must have at least 2 empty dropdown elements on the page and a recordset.
Then you can open the FX Dependent ListMenu object from the Insert-->Felixone Objects menu in the top bar or from the Felixone Objects submenu in the Insert panel.

Elements: Here are listed all valid elements found on the page, only list/menu and textarea will be listed.
First of all check that the elements stay in the right chain order, no matter if on the page the dependent element is before than the master, here you will move down the dependent after the master using the up/down arrows above the list. If you will have a 2 level dependence move the first dependent after the master then the second dependent after the first dependent, taking care that a textarea it must be always the last (this is obvious).
Now select an element (we can start from the master) and apply the parameters which are listed below, and so forth you will select another element and apply the parameters.
Link to Recset: Select the recordset to which you want to bind the selected element. Each element of a chain set must relay always on the same recordset, but each chain may relay on different recordsets. Consider that you may create many chains at one time.
Value Column: Here you select the recordset column which will contain the value. Assume that the dependent element will be linked to this. For instance this column may be an unique ID (not necessarily) and the label a unique description of the item or just the same ID column.
In most cases, it would be obvious to use the same column for both label and value.
Label Column: Select here the recordset column which will display on the list.
Dependence: Here you will select the element from which will depend the selected one.
If " *** None " is selected the selected element will be ignored and not included in the set.
If " - Master - " is selected the selected element will be obviously a master not depending from other elements.
If you choose an element (here only the dropdowns will be listed) it means that the selected element will depend from the chosen element.
Default Value: You may optionally set a default value for Masters only, may be static or dynamic, so when the page loads the passed value will be soon selected.

Once you click OK inside the elements will appear the used recordset, this is only for visual translation so you can have an idea of where you are, do not write anything in the elements because it will be useless, the javascript code will override any contents. Then you can freely edit them and apply any visual formatting.

An example of multilevel dependence

Assume we have a products table and all required data is in this table. We want a Master which displays all the Categories, clicking on one category will display in the second one all Makes (or producer) available, then selecting a make will display all related Product ID and at end selecting a Product ID its description will appear on a textarea.

Create first a recordset which will recall the required data, it is up to you to create complex queries to recall data from different tables.
Create the form if you don't have one on the page, insert 3 list/menu and a textarea in the form if they do not already exists and name them appropriately. Open the object dialog and re-order the elements in the list if they are not ordered in a consequent chain (ie: category, make, id, description).

Select one element from the list, for commodity we start from the master. Look that it is not important at which moment you set up an element, it is important that the element is listed in the right order and that the settings follow the chain logic.
Then in the Link to Recset field we select the recordset created for the purpose, since the master will contain the categories (or what else you like to name it) we will assign the column Category as Label Col or a column which describes the category.
It would be not a bad thing to assign the same column as the Value Col unless you have one column which describes the category and one to identify it.
Now let's tell it's hierarchy, this of course will be the master then we will select " - Master - " from the Dependence field, the The Default Value will be enabled and yu may optinally define a static or dynamic value.

Select the second element, the one which will directly depend from the master, the Make element. The recordset will be the same (any element of a chain must use the same recordset), in the Label Col select the recordset column which report the make (it can be named Producer for example). As Value Col we can assign the same column as the label column. From the Dependence we choose the element from which this will depend, in this case the category dropdown element, the Default Value will be disabled because it is not a Master.

Now follow this logic for the other elements thinking to the element from which the selected one will depend, of course the Product ID element will depend from the Make element and so forth to the last which is the textarea which will display the description related to the item selected in the Product ID element. We could even add one more textarea which would depend from the same list it depends the description (Product ID) and bind to the recordset price column, then after the object is applied we can convert it to text field.

Click Ok and everything is ready. After that you may even convert a textarea in a single line text field if you wish, it would not make any problem and the application will work the same way.

Hints

You can create more dependent lists at the same time. Assume 2 simple pairs, each one has a master and a dependent, insert on the page 4 named list/menu then open the object and check that they are displayed on the list in the logic order, if not re-order them (in the page they can be displayed where you like), and proceed as explained above. Of course in this case you will have 2 masters.
You can apply the object twice instead and it will not be any difference.

by FELIXONE