Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Web Objects : HTML mapping examples : Complex HTML mapping that includes a SmartDataObject : Mapping with a SmartDataObject
 
Mapping with a SmartDataObject
You can specify dcustomer.w as the data source when you use the HTML Mapping Wizard to map an HTML file like w-custdir.htm:

w-custdir.htm

<html>
<head>
<title>Sample of Using HTML Mapping with an SDO</title>
</head>
<h3><font color="#000000">Customer Directory</font></h3>
<form ACTION="w-custdir.w" METHOD="POST">
  <input type="hidden" name="cusrowid"/>
  <input type="hidden" name="AddMode"/>
  <pre>
   <input NAME="SearchName" SIZE="20"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Search for Name"/>
    Name : <input NAME="Name" SIZE="34"/>
    Address: <input NAME="Address" SIZE="34"/>
      <input NAME="City" SIZE="12"/>
      <input NAME="State" SIZE="20"/>
      <input NAME="PostalCode" SIZE="10"/>
    Phone: <input NAME="Phone" SIZE="20"/>
    Email: <input NAME="EmailAddress" SIZE="20"/>
    Fax: <input NAME="Fax" SIZE="20"/>
    Sales Rep:<input NAME="SalesRep" SIZE="5"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="First"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Next"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Prev"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Last"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Save"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Add"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Delete"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Reset"/>
    <input TYPE="submit" NAME="requestedAction" VALUE="Cancel"/>
  </pre>
</form>
</body>
</html>
You can use the HTML Mapping Wizard's Automap feature to map the fields referenced in w-custdir.htm to the database fields referenced in dcustomer.w. Note that all the fields will map except the hidden fields and the SearchName field (shown in bold). These fields are used to pass information to the WebSpeed agent and do not reference fields in the database.
The hidden field, cusrowid, holds a value that identifies the current record that is displayed on the Web page. It establishes a context for the WebSpeed agent when the next request is submitted. The other hidden field, AddMode, holds a value that tells the WebSpeed agent if a new record is to be added or not added when the next request is submitted. The code that utilizes these hidden fields is explained in the following section.