$Web Form Action: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
No edit summary
 
(23 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Form_Action}}
{{DISPLAYTITLE:$Web_Form_Action}}
<span class="pageSubtitle"><section begin="desc" />Return action URL<section end="desc" /></span>
<span class="pageSubtitle">Return action URL</span>


<var>$Web_Form_Action</var> returns the relative URL of the current request.


<var>$Web_Form_Action</var> takes two arguments and returns a string.


$Web_Form_Action returns the relative URL of the current request.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %RC = $Web_Form_Action(pos, len)
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$Web_Form_Action</span>([<span class="term">pos</span>], [<span class="term">len</span>])
<section end="syntax" /></p>
</p>


===Syntax terms===
<table class="syntaxTable">
<tr><th>%rc</th>
<td>A numeric variable to contain the return code. </td></tr>


$Web_Form_Action takes two arguments and returns a string.  
<tr><th>pos</th>
<td>This numeric value 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. </td></tr>


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.  
<tr><th>len</th>
<td>This numeric value is the maximum number of characters to be returned. This is an optional parameter and it defaults to 255. </td></tr>
</table>


The second parameter is the maximum number of characters to be returned. This is an optional parameter and defaults to 255.  
==Usage notes==
<ul>
<li><var>$Web_Form_Action</var>, as the name might suggest, is most useful in generating the URL for the "action" attribute of the <code><form></code> 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 $Web_Form_Action 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" -
<br>Name:
action="{$Web_Form_Action}">
<input size=20 type="text" name="name" value="{%NAME}">
<br>Name:
<br>Rank:
<input size=20 type="text" name="name" -
<input size=12 type="text" name="rank" value="{%RANK}">
value="{%NAME}">
<br>Serial number:
<br>Rank:
<input size=12 type="text" name="serno" value="{%SERNO}">
<input size=12 type="text" name="rank" -
<br>
value="{%RANK}">
<input type="submit" value="Update">
<br>Serial number:
</form>
<input size=12 type="text" name="serno" -
END HTML
value="{%SERNO}">
<br><center>
<input type="submit" value="Update">
</center>
</form>
END HTML
</p>
</p>
 
<p>
 
If there is a possibility that the current relative URL along with the ISINDEX data is longer than 255 bytes, use <var>$Web_Form_Action</var> in a loop in conjunction with <var>[[$Web_Form_Action_Len]]</var>, as demonstrated here: </p>
If there is a possibility that the current relative URL along with the ISINDEX data is longer than 255 bytes, $Web_Form_Action should be used in a loop in conjunction with $Web_Form_Action_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 $Web_Form_Action_Len BY 255
FOR %I FROM 1 TO $Web_Form_Action_Len BY 255
PRINT $Web_Form_Action(%I) ...
PRINT $Web_Form_Action(%I) ...
END FOR
END FOR
PRINT '">'
PRINT '">'
</p>
</p>
</ul>


<p class="note"><b>Note:</b> The maximum Janus Web Server URL length is 1,024 bytes. </p>


The $Web_Form_Action function is available with Version 6.0 and later of ''[[Sirius Mods]]''.
==See also==
 
<ul>
See also [[$Web_Form_Action_Len]] and [[$Web_Form_Done]].
<li><var>[[$Web_Form_Done]]</var>
</ul>


[[Category:Janus Web Server $functions|$Web_Form_Action]]
[[Category:Janus Web Server $functions|$Web_Form_Action]]

Latest revision as of 21:59, 11 September 2019

Return action URL

$Web_Form_Action returns the relative URL of the current request.

$Web_Form_Action takes two arguments and returns a string.

Syntax

%rc = $Web_Form_Action([pos], [len])

Syntax terms

%rc A numeric variable to contain the return code.
pos This numeric value 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.
len This numeric value is the maximum number of characters to be returned. This is an optional parameter and it defaults to 255.

Usage notes

  • $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 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, use $Web_Form_Action 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 '">'

Note: The maximum Janus Web Server URL length is 1,024 bytes.

See also