The Database Managers, Inc.

Contact The Database Managers, Inc.

Use an RSS enabled news reader to read these articles.Use an RSS enabled news reader to read these articles.

DataFlex Decompiler

How-to create a combo box that is constrained to a parent table

by Curtis Krauskopf

1)  Create a relates-to constraint between the child table and parent table in the DDOs (Data Dictionary Object) of the WBO (Web Business Object).

2)  In the ASP code, tell the WBO to find the parent row (or record) in the parent DDO.
  <% err = oWbo.requestFindByRecID("parentName", parent_recId) %>

3)  In the ASP code, find the default record in the child DDO (this is optional and this step can be skipped)
One way to do this:
  <% err = oWbo.requestFindByRecID("childName", child_recId) %>

4)  Use the following template to create a combo box for the child.
The real work is done on the ddvalue() line.

<form name=ComboSelect action="NextPage.asp" method="POST">
<table border="0">
      <select SIZE="1" NAME="ChildName__Recnum" >
        <%=oWbo.ddvalue("childName.key", DDRECS) %>


  1. oWbo is the name of the web business object.  Use an appropriate WBO name, such as oCustomer, or oOrderDetail.
  2. parentName is the DataFlex name of the parent file of the relates-to constraint set up in step 1.
  3. childName is the DataFlex name of the child file of the relates-to constraint defined in step 1.
  4. parent_recID and child_recID both contain appropriate integers.  child_recID is only needed if the affect in step 3 is desired.
  5. In the example, the name of the selection object is ChildName__Recnum.  This should be changed to an appropriate name.  If you don't do this, two or more combo boxes on the same page will have the same name and that will cause problems.
  6. There is a way to make the ComboBox automatically submit when the user clicks on an item (assuming they have JavaScript enabled), This example shows how to make a drop-down box automatically submit when an item is selected.

Go Back to the WebApp Server and ASP Tips Page

Other Popular DataFlex topics at The Database Managers, Inc.:

WebApp Server: Tips | Installation | Books
Services | Programming | Contact Us | Recent Updates

Send feedback to: