Version 3.1 User's Guide |
|
Processing Forms |
Previous |
Next Contents |
NetCloak Pro adds an additional set of commands for processing data from HTML forms. These are in addition to the dynamic page commands, and are only available in the NetCloak Pro. Throughout this section and the Reference Guide this is assumed even though NetCloak Pro may not be specifically mentioned.
HTML forms are relatively simple to create, especially using modern HTML authoring tools. NetCloak is what processes the input from these forms after users click the Submit button, allowing you to make use of HTML forms on your site. NetCloak can take form data and perform any of several actions:
For more complex systems, NetCloak can take several actions after a single form submission or conditionally perform some actions based on the content of the form.
This section will introduce some vocabulary for forms processing, refresh (or introduce you to) your knowledge of HTML form tags, then present tutorials to introduce forms processing concepts with some example systems.
The tutorials are included in HTML format with the NetCloak demo package in the NetCloak Introduction. If you have not already reviewed these with a demo, you can install them now and see them in action as you follow along in this Guide.
There are a few terms you need to know to make the most of this User Guide. First, you should be completely familiar with HTML (Hyper Text Markup Language) and specifically HTML Forms. The terms Entry Form, or simply Form, used in this guide refer to an HTML document that accepts input from users. The form can contain fixed-length text fields, scrolling text blocks, pop-up menus, radio buttons, check boxes and any other input type supported in HTML.
This documentation will also refer to user-written Articles. An article is entered into an entry form, and is processed by NetCloak Pro into a formatted HTML document viewable by other users. The word "article" may not be entirely accurate for the system you are creating, but is used here to keep things simple. For example, if you were creating a system for entering recipes, each recipe would be considered an article.
Perhaps most importantly, you will need an FDML template document (Forms Definition Markup Language). This is the file that contains one or more instructions used by NetCloak Pro to process the data entered by a user. Each FDML document describes to NetCloak Pro how to store, create, or edit HTML documents, send an e-mail message, or turn data into a text file.
The following tutorials are provided to help get you started creating your own NetCloak Pro-based interactive Web server. There are many examples included with this NetCloak Pro distribution, accessible using your Web browser, and the following examples are designed to help you understand the basic concepts of the more popular NetCloak Pro functions.
This section will cover the basics of processing forms with NetCloak. Once you master FDML templates, directives and insertion commands you can implement on-line surveys, feedback forms or even threaded discussion forums that users can access with just their web browser.
Forms processing with NetCloak Pro is controlled by special template files you create using NetCloak's forms processing commands. These files tell NetCloak what to do with the data from the HTML form. Similar to a mail merge file in a word processor, the template also defines what the created text file, web page or e-mail message will look like.
The diagram below shows an overview of how forms processing works. First, the user enters data into an HTML form. When the user clicks the submit button, their web browser sends the data from the form to the server. With the data the browser also sends the action specified in the HTML form, which tells the server to use a NetCloak Pro FDML template to process the data.
Figure 2: Overview of forms processing with FDML Templates
The server passes the data and the name of the template to NetCloak, which then reads the template. First in the template is a directive that tells NetCloak what to do- in this case, CREATEDOC tells NetCloak to create a new HTML document. The rest of the template determines what the contents of the new HTML page will look like, and NetCloak inserts data from the form in place of the REPLACE commands. At the bottom of the diagram is the new HTML page that NetCloak has created.
The first step in building all forms processing systems isn't the FDML file, but rather the HTML input form itself. All modern HTML editors will allow you to build HTML forms, and they can also be created using any text editor without much difficulty. Building HTML forms is outside the scope of this tutorial, and how this is done will vary depending on your HTML editor. See the user guide that came with your HTML editor, or an HTML reference for how to create input forms in HTML. The NetCloak Reference Guide also has a brief reference list of HTML form fields if you need to brush up.
There is one aspect of the form that is dictated by NetCloak, the FORM ACTION. Every HTML form includes a FORM tag, and one of the parameters of this tag, the ACTION parameter, tells the browser where to send the information once the user fills in the form and clicks the submit button. When you create the form, the ACTION must be the URL to the FDML template. The URL is no different from what would go in an HREF; it can be a full, root relative, or partial URL.
The FORM tag will look like one of these, depending on the URL you specify:
<FORM METHOD=post ACTION="Feedback.FDML">
<FORM METHOD=post ACTION="/Development/Test.FDML">
<FORM METHOD=post ACTION="http://my.server.com/Support/Mail.FDML">
The most important part of the FDML file is the directive which will tell NetCloak how to process the form data. There are four primary actions NetCloak can perform when a form is submitted, each of which is invoked using a different Primary Directive at the beginning of the FDML file:
In the overview diagram of forms processing (figure 2) you can see the CREATEDOC directive in the FDML template.
The tutorial examples following this one describe how to use the most common directives, SENDMAIL, INSERTFILE and CREATEDOC. The simplest, TEXTSTORE, is straightfoward enough that you should be able to understand it with the explanation in the Reference Guide. One of the simpler and most popular of the remaining directives is SENDMAIL, so we will start there.
Before jumping right into how to make your own FDML template files, there are a few general points about FDMLs. To start, remember that FDML files are not HTML files, so the WYSIWYG HTML editor you are used to using is not a good choice for creating FDMLs. Some FDML files will create HTML or HTML documents, so an HTML editor can be useful for creating the design of the resulting pages. However, once you have roughed out the format with an HTML editor you will want to use a text editor like BBEdit to finish up. Using an FDML file to send an e-mail message, though, really has nothing to do with HTML so you should start and end with your text editor.
This may appear to work if you try it. When many WYSIWYG HTML editors output the final site, though, they will attempt to check and fix the HTML syntax. Since the NetCloak forms processing commands look like HTML, these applications frequently assume that they are malformed HTML tags and try to "fix" them. This "fix" will generally ruin your FDML template.
There is hope, though. Dreamweaver can be extended with objects for third-party add-on tags like NetCloak commands. A set of Dreamweaver objects for NetCloak is included in the package, and with them, you will be able to create pages with NetCloak's dynamic page and forms processing commands right in Dreamweaver. Similar extensions may be available for other editors soon.
Copyright © 1996-2000 Maxum Development Corporation http://www.maxum.com/ |
Previous |
Next Contents |