$Web Num: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 32: Line 32:
<ul>
<ul>


<li>[[<var>$Web_Parm_Len]]</var>  
<li><var>[[$Web_Parm_Len]]</var>  
<li>[[<var>$Web_Name]]</var>  
<li><var>[[$Web_Name]]</var>  
<li>[[<var>$Web_Parm]]</var>  
<li><var>[[$Web_Parm]]</var>  
<li>[[<var>$Web_Num_Form]]</var>  
<li><var>[[$Web_Num_Form]]</var>  
<li>[[<var>$Web_Num_IsIndex]]</var>
<li><var>[[$Web_Num_IsIndex]]</var>
</ul>
</ul>
For a discussion of isindex and form requests and data, see .
For a discussion of isindex and form requests and data, see .


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

Revision as of 20:24, 12 June 2012

<section begin="desc" />Number of isindex and form fields<section end="desc" />


$Web_Num retrieves the number of isindex and form fields in a URL.

Syntax

<section begin="syntax" /> %COUNT = $Web_Num( fieldname ) <section end="syntax" />


$Web_Num takes a single optional argument and returns a number.

fieldname Specifies to count only the isindex and form fields that match fieldname. If omitted, returns the count of all isindex and form fields.


An application written to handle isindex and form fields generically would need to determine the number of isindex and form fields in a URL before finding the names of the fields.

%I_COUNT = $Web_Num FOR %I FROM 1 TO %I_COUNT %RC = $SETG($Web_Name(%I), $Web_Parm(,%I)) END FOR


In this example, a global variable is set to contain the values of all isindex and form fields set by the browser. The name of the global is the name of the form or isindex field and its value is, of course, the form or isindex field value. This example will not work correctly if there are two or more isindex and/or form fields that share the same name. Multiple fields with the same name are common occurrences in HTML forms, especially in <select> lists that generate a fieldname/value pair for each item selected from the list.

$Web_Num first counts isindex fields and then form fields. $Web_Num can be used instead of $WEB_ISINDEX_NUM and $WEB_FORM_NUM to make it easy to switch between using "method=GET" and "method=POST"<form> tags and simply to save typing.

See also:

For a discussion of isindex and form requests and data, see .