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 then given
to it in the input field of the form. Form methods 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>
- 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
displays an error message if the visitor forgets to enter text
into any of those 3 fields.
There are several ways you can set the value of variables while
displaying a WebDNA template. When you configure WebStar's
suffix-mapping to automatically send all URLs to WebDNA, it
assumes a showpage command is being used, and the template is
the URL you are visiting:
- 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>