NetForms 2.5 User's Guide

A Tricky Example


This example is a feedback system included with your NetForms disk that allows users to enter comments about the Internet into your server. Other users can then add responses to the original comments. Before you start reading how the tricky example is put together, make sure you have entered a few articles and know how it works. Go to the NFStart.html page and click on Feedback under the Examples.

The Feedback home page is a standard HTML document with links to the original article entry form and to several separate menu documents. In this example, new articles will be broken down into one of several forums to make it easier for users to find what they want. This particular example uses the forums "General Internet", "This Site", and "Other Sites", but it could be any other logical breakdown of topics. The recipe system, for example, could have had forums for "main courses", "desserts", etc.

Each of the forums has its own menu document. These documents are all exactly the same, except for their titles and minor variations in their text. Most importantly, since each menu document will be updated by NetForms, each needs to have a single unordered list.

The entry form includes a pop-up list for the topic name instead of a text entry box to avoid user typos. Besides assuring inclusion on the correct list, it is easier for the user. The rest of the form is straightforward.

Now for the interesting part. The "Feedback.FDML" file will generate the original articles. Responses to original articles will be handled by another separate FDML document. The "Feedback.FDML" file is as follows:

  1)  <CREATEDOC>"/Feedback/<REPLACE_FN ForumName>Articles/<REPLACE_FN DocTitle>.html"</CREATEDOC>
  2)  <AUTOLINK>"/AutoLink.doc"</AUTOLINK>
  3)  <MENUDOC>"/Feedback/<REPLACE_FN ForumName>Menu.html" <LI> <A HREF="<HTMLFILENAME>"><REPLACE DocTitle>(<DATE>)</A></MENUDOC>
  4)  <RESPONSE>"/Feedback/Response.html"</RESPONSE>
  5)  <RECENTLIST><LI> <A HREF="<HTMLFILENAME>"> <REPLACE DocTitle></A></RECENTLIST>
  6)  <HTML>
  7)  <HEAD>
  8)  <TITLE><REPLACE DocTitle></TITLE>
  9)  </HEAD>
  10) <BODY>
  11) <H1><REPLACE DocTitle></H1>
  12) <ADDRESS>This article submitted by <REPLACE Author> on <DATE>. </ADDRESS>
  13) <BR>
  14) <REPLACE ArticleText>
  15) <P>
  16) <LINKNEXT><BR>
  17) <LINKPREVIOUS><BR>
  18) <A HREF="<MENUFILENAME>">Return to Topic Menu</A>
  19) <HR>
  20) <H3>Here is a list of responses that have been posted to this article...</H3>
  21) <UL>
  22) </UL>
  23) <HR>
  24) <H3>If you would like to post a response to this article, fill out this form completely </h3>
  25) <FORM method=POST action= "/NetForms.acgi$/Feedback/FeedbackResponse.FDML">
  26) Response Title: <INPUT TYPE="text" NAME="DocTitle" SIZE="32" MAXLENGTH= "32"> <BR>
  27) Author: <INPUT TYPE="text" NAME="Author" SIZE="32" MAXLENGTH="32"><P>
  28) Response Text:<BR>
  29) <TEXTAREA name="ArticleText" rows=10 cols=60></textarea><P>
  30) Original Article: <INPUT TYPE="text" NAME="OrigArticle" SIZE="20" MAXLENGTH="40" VALUE="<REPLACE DocTitle>"> (Don't change this field!)
  31) <BR>
  32) Forum: <INPUT TYPE="text" NAME="OrigForum" SIZE="16" MAXLENGTH="16" VALUE="<REPLACE ForumName>"> (Don't change this field either!)
  33) <P>
  34) <INPUT type=submit value="Submit Response"> <input type=reset value="Start Over"><p>
  35) </FORM>
  36) <HR>
  37) Article complete. Click <A HREF="/Feedback/Feedback.html">HERE</A>
  38) To return to the Feedback Menu.
  39) </BODY>
  40) </HTML>

Line 1 - The <CREATEDOC> directive places the new document into a sub folder based on the name of the forum using the <REPLACE_FN> insertion command.

Placing documents into separate forum sub-folders is not necessary, but will help to keep the documents in each folder to a manageable number, in addition to providing a logical breakdown.

Notice the use of <REPLACE_FN> here where the value will be used as a file or folder name.

Line 2 - The <AUTOLINK> directive will create automatic links to any key words entered by the user which match entries in the AutoLink.doc file. See the section on the AutoLink directive for an explanation of how this works.

Line 3 - The <MENUDOC> directive again uses the <REPLACE_FN> command to update the menu document for the selected forum.

Note the use of the <HTMLFILENAME> insertion command. This command inserts the path and filename for the html file specified in the <CREATEDOC> directive. We could have repeated the parameter inside the <CREATEDOC> directive, but the <HTMLFILENAME> command is much shorter and makes it easier to understand what is going on.

Here comes the real trick to this example: The HTML documents generated by this document will contain not only the content of the original message, but an input form and menu of responses.

Lines 16-17 - The <LINKNEXT> and <LINKPREVIOUS> insertion commands here will automatically insert links to the previous article and next article entered. When it creates the HTML document for the current article, NetForms will put a placeholder in place of the <LINKNEXT> tag, and replace it with a real link when the next article is entered.

Line 17 - The <MENUFILENAME> here will automatically insert the complete name and path to the menu file specified in the <MENUDOC> directive. We could have repeated what was inside the MENUDOC directive, but this is a handy shortcut.

Lines 21-22 - Note the bullet list (<UL></UL>, since it's empty to begin with), which is preceded by a text blurb stating that responses are available. This bullet list will be updated automatically when responses are posted to the original article.

Lines 24-35 - Here is another entry form at the end of the document which the FDML file will create in the new article. The last two fields, when the form is displayed, will default to the correct values and cannot be modified by the users. This is where the name of the original article is passed to the FDML which will process the response.

When a user fills in the response entry form, NetForms will again be invoked, but this time, it will use the "FeedbackResponse.FDML" file:

  1)  <CREATEDOC>"/Feedback/<REPLACE_FN OrigForum>Articles/<REPLACE_FN DocTitle>.html"</CREATEDOC>
  2)  <AUTOLINK>"/AutoLink.doc" </AUTOLINK>
  3)  <MENUDOC>"/Feedback/<REPLACE_FN OrigForum>Articles/ <REPLACE_FN OrigArticle>.html" <LI> <A HREF="<HTMLFILENAME>"><REPLACE DocTitle> (<DATE>)</A></MENUDOC>
  4)  <RESPONSE>"/Feedback/Response.html"</RESPONSE>
  5)  <RECENTLIST><LI> <A HREF="<MENUFILENAME>"> <REPLACE OrigArticle></A></RECENTLIST>
  6)  <HTML>
  7)  <HEAD>
  8)  <TITLE><REPLACE DocTitle></TITLE>
  9)  </HEAD>
  10) <BODY>
  11) <H1><REPLACE DocTitle></H1>
  12) <ADDRESS>This response submitted by <REPLACE Author> on <DATE>.</ADDRESS>
  13) <BR>
  14) <REPLACE ArticleText>
  15) <P>
  16) <LINKNEXT><BR>
  17) <LINKPREVIOUS><BR>
  18) <A HREF="<MENUFILENAME>">Return to Main Article</A>
  19) <HR>
  20) Article complete. Click <A HREF="/Feedback/Feedback.html">HERE</A>
  21) To return to the Feedback Menu.
  22) </BODY>
  23) </HTML>

The notable thing in FeedbackResponse.FDML is that it uses the original article document as its menu document. By doing this, responses will be added directly in to the bullet list on the original article page.

One additional note about the Tricky Example. Two fields in the "Feedback.FDML" file, "OrigArticle" and "OrigForum", were implemented as standard text fields in order to make what is happening more clear in the example. In a production system, you would most likely want to make these hidden fields so that the user won't ever see them. See an HTML language guide for more details on hidden fields.


[ Examples Menu Page | Table Of Contents ]

Copyright © 1996-8 Maxum Development Corporation
820 South Bartlett Road - Suite 104
Streamwood, IL 60107
http://www.maxum.com/