HTML Form Variables
- [VariableName] can be any named form variable
You may display the values of any variables that were part of a form used to reach
a URL. Insert the value by enclosing the name of the variable in square brackets.
The name is that given to it in the input field of the form. Form method POST and
GET are both supported. If you create a URL that mimics a form method GET (an HREF-style
hyperlink), then you must put a question mark after the template name followed by
the variables and their values.
Example (normally you would put the following text into a .tpl file on
your server and use a web browser to link to it):
- <a href="test.tpl?var1=Hello&var2=World">Hello</a>
-
- ---test.tpl---
- The value of var1 is [var1]<br>
- The value of var2 is [var2]<br>
Try It!
- Note: You may force the visitor to enter something into a form field by
using the RequiredFields parameter in the URL or hidden form value. Setting
RequiredFields=field1+field2+field3 will display an error message if the visitor
forgets to enter some text into any of those 3 fields.
There are several ways you can set the value of variables while displaying a WebCatalog
template. When you configure WebStar's suffix-mapping to automatically send all URLs
to WebCatalog, it assumes a showpage command is being used, and the template is the
URL you are visiting:
- Action-based suffix-mapping for .tpl
- Hyperlink to a URL (assumes suffix-mapping for .tpl)
- <a href="xxx.tpl?var1=xx&var2=xx"> (no command assumes showpage)
- <a href="xxx.tpl?command=search&var1=xx&var2=xx">
- Form method="GET" (assumes suffix-mapping for .tpl)
- <form method="GET" action="xxx.tpl">
- <input type="hidden" name="var1" value="value1">
- <input name="var2">
- <input type="submit" value="OK">
- </form>
- Form method="POST" (assumes suffix-mapping for .tpl)
- <form method="GET" action="xxx.tpl">
- <input type="hidden" name="var1" value="value1">
- <input name="var2">
- <input type="submit" value="OK">
- </form>
- Explicitly sending commands to the CGI (no suffix-mapping). If no suffix-mappings
are defined, then you must explicitly specify what template is to be displayed, as
well as the command to send to WebCatalog.
- <a href="WebCatalog.acgi?command=showpage&template=xxx.tpl?var1=xx&var2=xx">
- Form method="GET"
- <form method="GET" action="WebCatalog.acgi">
- <input type="hidden" name="command" value="showpage">
- <input type="hidden" name="template" value="xxx.tpl">
- <input type="hidden" name="var1" value="value1">
- <input name="var2">
- <input type="submit" value="OK">
- </form>
- Form method="POST" (assumes suffix-mapping for .tpl)
- <form method="GET" action="WebCatalog.acgi">
- <input type="hidden" name="command" value="showpage">
- <input type="hidden" name="template" value="xxx.tpl">
- <input type="hidden" name="var1" value="value1">
- <input name="var2">
- <input type="submit" value="OK">
- </form>