KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Creating static menu selections
PRODUCT: 4D Business Kit | VERSION: 2.x | PLATFORM: Mac & Win
Published On: August 12, 2004

You may want to build a site where static menus are used to find and list product families from the database. For example, the code below generates a dynamic L01 list based on the products in the database.

<select style="font-family:Verdana, Arial;font-size:10px;width:125px" name="L01" onChange="if(this.selectedIndex>0) top.liste.location='4DBKExecute:4DBKStoreSet/[store];4DBKSelectionSet/1;4DBKCursorSet/1;4DBKQuerySet/L01='+this.options[this.selectedIndex].value+';4DBKGo/list.htm'; this.selectedIndex=0;">
<option value="">Category</option>
<!--#4DBKStoreSet/[store]-->
<!--#4DBKSelectionSet/2-->
<!--#4DBKQuerySet/all-->
<!--#4DBKSelectionDistinct/L01-->
<!--#4DBKMenu/L01-->
</select>

To build static menus, simply create them via html. Have the select statement execute the same 4DBK code (as above) after a selection has been made. Note that the select statement has not changed, rather the options for the select statement has.

<select style="font-family:Verdana, Arial;font-size:10px;width:125px" name="L01" onChange="if(this.selectedIndex>0) top.liste.location='4DBKExecute:4DBKStoreSet/[store];4DBKSelectionSet/1;4DBKCursorSet/1;4DBKQuerySet/L01='+this.options[this.selectedIndex].value+';4DBKGo/list.htm'; this.selectedIndex=0;">
<option value="">Category</option>
<option value="Black"> Black </option>
<option value="Blue"> Blue </option>
<option value="Brown"> Brown </option>
<option value="Green"> Green </option>
<option value="Red"> Red </option>
<option value="Yellow"> Yellow </option>
</select>