DBWEB: How to Create a Dynamic Combo Box in a dbWeb Custom DBX
ID: Q155673
|
The information in this article applies to:
-
Microsoft dbWeb, versions 1.0, 1.1
SUMMARY
This article describes a technique that will dynamically populate an HTML
combo box in a Microsoft dbWeb custom DBX.
MORE INFORMATION
In order to dynamically populate a combo box in an HTML QBE form using the
dbWeb Administrator, you must set the data value property for the
appropriate field in the QBE tab to #autofill# (or #autofill+# if you want
the first value displayed in the combo box to be blank). However, you may
want to use a custom DBX to create your HTML form so you can use HTML tags
that dbWeb doesn't generate automatically. In order to fill a combo box
with values in a custom DBX, you must create two schemas. The first schema
contains a custom DBX that uses dbWeb banding tags to populate the combo
box; then it uses the POST method to send the value you select in the combo
box to the getresults or getxresults method for the second schema. Follow
the steps below to create a sample custom DBX with a dynamically populated
combo box.
The following example shows you how to create an ODBC data source and two
dbWeb schemas to dynamically fill a combo box with customer ID numbers.
The example uses the sample database Northwind.mdb from Microsoft Access
for Windows 95 as the data source. It assumes that you are using the
default paths for Microsoft Internet Information Server. If you are using
other web server software, adjust these paths accordingly.
Creating the ODBC Data Source
- Start the dbWeb Administrator.
- On the Utilities menu, click ODBC Manager.
- In the Data Sources dialog box, click System DSN, and then click Add.
- Click Microsoft Access Driver, and then click OK.
- In the Data Source Name box, type Acc95.
- Under Database, click the Select button.
- In the Select Database dialog box, locate the sample database
Northwind.mdb, and then click OK.
- In the ODBC Microsoft Access 7.0 Setup dialog box, click OK.
- Close the ODBC Manager.
Creating the First dbWeb Schema
- In the Data Sources window of the dbWeb Administrator, click Data
Sources And Schemas, and then click New Datasource.
- In the Data Source Name box, type Acc95, and then click OK.
- Click the Acc95 Data Source, and then click New Schema.
- In the New Schema dialog box, click the New Schema button.
- Under Schema name, type Dynabox1.
- Click the Tables tab.
- Click the Customers table, and then click Add.
- Click the Tabular tab.
- In the "Data columns in selected tables" box, double-click Customers.
- Click CustomerID, and then click Add.
- Click the DBX tab.
- Click the Editor button next to "Multi record result output custom
format file."
- Type the following HTML code in the right pane of the Editor, depending
on your version of dbWeb.
Microsoft dbWeb version 1.0:
<HTML>
<TITLE>Customer List</TITLE>
<BODY>
<FORM METHOD="POST"
ACTION="/scripts/dbweb/$dbwebc.exe/Dynabox2?getresults">
Please select a Customer ID from the list.<BR>
<!--BUILD THE FORM-->
<!--Orders is the second argument of NAME-->
<!--because the result will be used-->
<!--to filter the Orders table-->
<SELECT NAME="4,Orders,CustomerID">
<!--Start of banding to fill the combo box-->
\tbon\t
<OPTION>\tobj\tCustomers\tcol\tCustomerID\t
\tboff\t
<!--End of banding-->
</SELECT><BR>
<INPUT TYPE="checkbox" NAME="8,all,rows"> Use full-screen output
even if more than one row is returned.<BR>
Return no more than <INPUT VALUE="100" SIZE="4" NAME="9,9,9">
rows (maximum 100).<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit Query">
</FORM>
</BODY>
</HTML>
Microsoft dbWeb version 1.1:
<HTML>
<TITLE>Customer List</TITLE>
<BODY>
<FORM METHOD="POST"
ACTION="/scripts/dbweb/dbwebc.dll/Dynabox2?getresults">
Please select a Customer ID from the list.<BR>
<!--BUILD THE FORM-->
<!--Orders is the second argument of NAME-->
<!--because the result will be used-->
<!--to filter the Orders table-->
<SELECT NAME="4,Orders,CustomerID">
<!--Start of banding to fill the combo box-->
\tbon\t
<OPTION>\tobj\tCustomers\tcol\tCustomerID\t
\tboff\t
<!--End of banding-->
</SELECT><BR>
<INPUT TYPE="checkbox" NAME="8,all,rows"> Use full-screen output
even if more than one row is returned.<BR>
Return no more than <INPUT VALUE="100" SIZE="4" NAME="9,9,9">
rows (maximum 100).<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit Query">
</FORM>
</BODY>
</HTML>
- Save the file as Dynabox.htm and close the DBX Editor.
- Click the Browse button next to "Multi record output custom format
file," select Dynabox.htm, and then click OK.
- In the Dynabox1 [Acc95] dialog box, click OK.
Creating the Second dbWeb Schema
- Click the Acc95 Data Source, and then click New Schema.
- In the New Schema dialog box, click the New Schema button.
- Under Schema name, type Dynabox2.
- Click the Tables tab.
- Click the Orders table, and then click Add.
- Click the Tabular tab.
- In the "Data columns in selected tables" box, double-click Orders.
- Click OrderID, and then click Add.
- Click the Freeform tab.
- In the "Data columns in selected tables" box, double-click Orders.
- Click OrderID, and then click Add. Click CustomerID, and then click
Add.
- In the Dynabox2 [Acc95] dialog box, click OK.
Testing the Results
- Type the following URL into the Address line of a browser, depending on
your version of dbWeb.
Microsoft dbWeb version 1.0:
http://<hostname>/scripts/dbweb/$dbwebc.exe/Dynabox1?getxresults
Microsoft dbWeb version 1.1:
http://<hostname>/scripts/dbweb/dbwebc.dll/Dynabox1?getxresults
- Select a CustomerID from the combo box, and then click Submit Query.
- Note that the results display only the order numbers for the customer
you selected.
Additional query words:
Keywords : kbusage DbwebUtils
Version : WINDOWS:1.0,1.1
Platform : WINDOWS
Issue type : kbhowto
|