$Web Form Action: Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Web_Form_Action | {{DISPLAYTITLE:<var>$Web_Form_Action</var>.} | ||
<span class="pageSubtitle"><section begin="desc" />Return action URL<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Return action URL<section end="desc" /></span> | ||
<var>$Web_Form_Action</var> returns the relative URL of the current request. | <var><var>$Web_Form_Action</var>./var> returns the relative URL of the current request. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %RC = $Web_Form_Action | <p class="syntax"><section begin="syntax" /> %RC = <var>$Web_Form_Action</var>.pos, len) | ||
<section end="syntax" /></p> | <section end="syntax" /></p> | ||
<var>$Web_Form_Action</var> takes two arguments and returns a string. | <var><var>$Web_Form_Action</var>./var> takes two arguments and returns a string. | ||
The first parameter is the starting position in the URL for the current request to be returned. This is an optional parameter, and it defaults to one, meaning that the current URL is returned starting at the first character. | The first parameter is the starting position in the URL for the current request to be returned. This is an optional parameter, and it defaults to one, meaning that the current URL is returned starting at the first character. | ||
Line 16: | Line 16: | ||
The second parameter is the maximum number of characters to be returned. This is an optional parameter and defaults to 255. | The second parameter is the maximum number of characters to be returned. This is an optional parameter and defaults to 255. | ||
$WEB_FORM_ACTION, as the name might suggest, is most useful in generating the URL for the "action" attribute of the <form> tag in HTML. This is especially useful if the current URL includes ISINDEX data that might be relatively difficult to reconstruct otherwise. The following demonstrates how one might use the <var>$Web_Form_Action</var> function in a form generated with the HTML statement. | $WEB_FORM_ACTION, as the name might suggest, is most useful in generating the URL for the "action" attribute of the <form> tag in HTML. This is especially useful if the current URL includes ISINDEX data that might be relatively difficult to reconstruct otherwise. The following demonstrates how one might use the <var><var>$Web_Form_Action</var>./var> function in a form generated with the HTML statement. | ||
<p class="code"> HTML | <p class="code"> HTML | ||
<form method="POST" action="{$Web_Form_Action | <form method="POST" action="{<var>$Web_Form_Action</var>."> | ||
<br>Name: | <br>Name: | ||
<input size=20 type="text" name="name" value="{%NAME}"> | <input size=20 type="text" name="name" value="{%NAME}"> | ||
Line 33: | Line 33: | ||
If there is a possibility that the current relative URL along with the ISINDEX data is longer than 255 bytes, <var>$Web_Form_Action</var> should be used in a loop in conjunction with $ | If there is a possibility that the current relative URL along with the ISINDEX data is longer than 255 bytes, <var><var>$Web_Form_Action</var>./var> should be used in a loop in conjunction with <var>$Web_Form_Action</var>.Len as demonstrated here: | ||
<p class="code"> PRINT '<form method="POST" action="' ... | <p class="code"> PRINT '<form method="POST" action="' ... | ||
FOR %I FROM 1 TO $ | FOR %I FROM 1 TO <var>$Web_Form_Action</var>.Len BY 255 | ||
PRINT $Web_Form_Action | PRINT <var>$Web_Form_Action</var>.%I) ... | ||
END FOR | END FOR | ||
PRINT '">' | PRINT '">' | ||
</p> | </p> | ||
The <var>$Web_Form_Action</var> function is available with Version 6.0 and later of ''[[Sirius Mods]]''. | The <var><var>$Web_Form_Action</var>./var> function is available with Version 6.0 and later of ''[[Sirius Mods]]''. | ||
See also [[$ | See also [[<var>$Web_Form_Action</var>.Len]] and [[$Web_Form_Done]]. | ||
[[Category:Janus Web Server $functions|$Web_Form_Action | [[Category:Janus Web Server $functions|<var>$Web_Form_Action</var>.] |
Revision as of 20:54, 6 June 2012
{{DISPLAYTITLE:$Web_Form_Action.} <section begin="desc" />Return action URL<section end="desc" />
$Web_Form_Action./var> returns the relative URL of the current request.
Syntax
<section begin="syntax" /> %RC = $Web_Form_Action.pos, len) <section end="syntax" />
$Web_Form_Action./var> takes two arguments and returns a string.
The first parameter is the starting position in the URL for the current request to be returned. This is an optional parameter, and it defaults to one, meaning that the current URL is returned starting at the first character.
The second parameter is the maximum number of characters to be returned. This is an optional parameter and defaults to 255.
$WEB_FORM_ACTION, as the name might suggest, is most useful in generating the URL for the "action" attribute of the <form> tag in HTML. This is especially useful if the current URL includes ISINDEX data that might be relatively difficult to reconstruct otherwise. The following demonstrates how one might use the $Web_Form_Action./var> function in a form generated with the HTML statement.
HTML
<form method="POST" action="{$Web_Form_Action.">
Name:
<input size=20 type="text" name="name" value="{%NAME}">
Rank:
<input size=12 type="text" name="rank" value="{%RANK}">
Serial number:
<input size=12 type="text" name="serno" value="{%SERNO}">
<input type="submit" value="Update">
</form>
END HTML
If there is a possibility that the current relative URL along with the ISINDEX data is longer than 255 bytes, $Web_Form_Action./var> should be used in a loop in conjunction with $Web_Form_Action.Len as demonstrated here:
PRINT '<form method="POST" action="' ... FOR %I FROM 1 TO $Web_Form_Action.Len BY 255 PRINT $Web_Form_Action.%I) ... END FOR PRINT '">'
The $Web_Form_Action./var> function is available with Version 6.0 and later of Sirius Mods.
See also [[$Web_Form_Action.Len]] and $Web_Form_Done.
[[Category:Janus Web Server $functions|$Web_Form_Action.]