Creating context sensitive links
If your data contains a field which categorizes the records you can easily create context sensitive links in the HTML returned to users. For example suppose you have a list of restaurants which can be categorized by cuisine. You might want to put ads (images) in the paged genreated by WebDataServer which depend on the cusine the user selects. To accomplish this, first put an input in your form which lets the user select the cusine. Assuming the input is named cuisine the following would go in your header template:
<IMG SRC="•cuisine•.gif">
Placeholders in header and footer templates just echo the user's entries so this would create a reference to the gif file corresponding to the user's cuisine selection.
How to make links appear?
See 'How to make images appear?'
What if some records need links but others do not?
Add two fields to your data. For those without links, leave the fields blank. For those with links put the the anchor tag and your URL in the first field and the end anchor tag in the second. For example the first field might contain: <A HREF="TheFunnyMovie.html"> and the second field would contain: </A>. In the template you would put •field1••movieName••field2• (assuming movieName is a
data field). Then only those records with links would show up as links.
I want users to search my data on field 'Name'. How do I force the user to enter a 'Name'?
Put the following line into your config file:
Required=Name
SortField
The list of matching records that is returned to the user is sorted by this field. By using a radio button named SortField
whose values are the names of fields, you can let the user select how the results are sorted.
Master/Detail Joins
Remember an html page can have multiple forms. You can include a form in your body template with a detail button which accesses associated info
in another data set. Put a hidden field in the form which has a field which joins the two data sets and make sure there is a DataSet input
element to indicate where to get the detail data from.
Example form html to put in body template:
<FORM ACTION="/DataServer/WebDataServer.acgi" METHOD="POST" ENCTYPE="x-www-form-encoded">
<INPUT TYPE="hidden" NAME="ID_FIELD_IN_DETAIL" VALUE="•ID_FIELD_IN_MASTER•">
<INPUT TYPE="hidden" NAME="CURRTITLE" VALUE="•CURRTITLE•">
<INPUT TYPE="hidden" NAME="SortField" VALUE="LASTNAME">
<INPUT TYPE="submit" NAME="DataSet" VALUE="Actors">
<INPUT TYPE="submit" NAME="DataSet" VALUE="Executive">
</FORM>
Note here the DataSet value is the value of the submit button - the user could retreive either the names of the actors or the executives which are two datasets both of which are details for a master set that they link with on the ID_FIELD and CURRTITLE fields.
Hide, Hide, Hide
You will find hidden inputs to be very useful. And you can use JavaScript to set values for
hidden inputs in response to user inputs. For example you might use radio buttons to allow
the user to select a report format. The radio buttons' 'onclick' script could set the
values of hidden inputs named HeadFile, BodyFile and FootFile to control the format of the
results.