IBM Books

Administration and Programming Guide for OS/400

HTML Forms

You can dynamically customize the execution of your Net.Data macros using HTML forms. Forms allow users to provide input values that can affect the execution of the macro and the contents of the Web page that Net.Data builds.

The following example builds on the monitor list example in HTML Links by letting users at a browser use a simple HTML form to select the type of product for which information will be displayed.

<H1>Hardware Query Form</H1>
<HR>
<FORM METHOD=POST ACTION="/cgi-bin/db2www/equiplst.d2w/report">
<P>What type of hardware do you want to see?
<MENU>
<LI><INPUT TYPE="RADIO" NAME="hdware" VALUE="MON" checked> Monitors
<LI><INPUT TYPE="RADIO" NAME="hdware" VALUE="PNT"> Pointing devices
<LI><INPUT TYPE="RADIO" NAME="hdware" VALUE="PRT"> Printers
<LI><INPUT TYPE="RADIO" NAME="hdware" VALUE="SCN"> Scanners
</MENU>
 
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
 

After the user at the browser makes a selection and clicks on the Submit button, the Web server processes the ACTION parameter of the FORM tag, which invokes Net.Data. Net.Data then executes the HTML report block in the equiplst.d2w macro:

%DEFINE DATABASE="MNS97"
 
 %FUNCTION(DTW_SQL) myQuery(){
SELECT MODNO, COST, DESCRIP FROM EQPTABLE
WHERE TYPE='$(hdware)'
%REPORT{
<H3>Here is the list you requested</H3>
%ROW{
<HR>
$(N1): $(V1), $(N2): $(V2)
<P>$(N3): $(V3)
%}
%}
%}
 
%HTML(report){
@myQuery()
%}

In the above example, the value of TYPE=$(hdware) in the SQL statement is taken from the HTML form input.

See Net.Data Reference for a detailed description of the variables that are used in the ROW block.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]