$Web Num: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:$Web_Num}} <span class="pageSubtitle"><section begin="desc" />Number of isindex and form fields<section end="desc" /></span> $Web_Num retrieves the number of is...")
 
mNo edit summary
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Num}}
{{DISPLAYTITLE:$Web_Num}}
<span class="pageSubtitle"><section begin="desc" />Number of isindex and form fields<section end="desc" /></span>
<span class="pageSubtitle">Number of isindex and form fields</span>


<var>$Web_Num</var> retrieves the number of isindex and form fields in a URL.


<var>$Web_Num</var> takes a single optional argument and returns a number.


$Web_Num retrieves the number of isindex and form fields in a URL.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %COUNT = $Web_Num( fieldname )
<p class="syntax"><span class="term">%count</span> = <span class="literal">$Web_Num</span>( [<span class="term">fieldname</span>] )
<section end="syntax" /></p>
</p>
 


$Web_Num takes a single optional argument and returns a number.
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>fieldname</th>
<tr><th>fieldname</th>
<td>Specifies to count only the isindex and form fields that match ''fieldname''. If omitted, returns the count of all isindex and form fields.
<td>Specifies to count only the isindex and form fields that match <var class="term">fieldname</var>. If omitted, returns the count of all isindex and form fields.
</td></tr></table>
</td></tr></table>


==Usage notes==
<ul>
<li><var>$Web_Num</var> first counts isindex fields and then form fields. <var>$Web_Num</var> can be used instead of <var>[[$Web_Num_IsIndex]]</var> and <var>[[$Web_Num_Form]]</var> to make it easy to switch between using "method=GET" and "method=POST" <code><form></code> tags and simply to save typing.
<li>For a discussion of isindex and form requests and data, see [[Janus Web Server application coding considerations#URL parameters or isindex data|URL parameters or isindex data]].
</ul>


==Examples==
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.
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.
<p class="code"> %I_COUNT = $Web_Num
<p class="code">%I_COUNT = $Web_Num
FOR %I FROM 1 TO %I_COUNT
FOR %I FROM 1 TO %I_COUNT
%RC = $SETG($Web_Name(%I), $Web_Parm(,%I))
  %RC = $SETG($Web_Name(%I), $Web_Parm(,%I))
END FOR
END FOR
</p>
</p>


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 <code><select></code> lists that generate a fieldname/value pair for each item selected from the list.


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.
==See also==
 
$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:
<ul>
<ul>
<li><var>[[$Web_Parm_Len]]</var>
<li><var>[[$Web_Name]]</var>
<li><var>[[$Web_Parm]]</var>
<li><var>[[$Web_Num_Form]]</var>
<li><var>[[$Web_Num_IsIndex]]</var>
</ul>


<li>[[$Web_Parm_Len]]
<li>[[$Web_Name]]
<li>[[$Web_Parm]]
<li>[[$Web_Num_Form]]
<li>[[$Web_Num_IsIndex]]
</ul>
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]]

Latest revision as of 17:18, 10 October 2014

Number of isindex and form fields

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

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

Syntax

%count = $Web_Num( [fieldname] )

Syntax terms

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

Usage notes

  • $Web_Num first counts isindex fields and then form fields. $Web_Num can be used instead of $Web_Num_IsIndex and $Web_Num_Form to make it easy to switch between using "method=GET" and "method=POST" <form> tags and simply to save typing.
  • For a discussion of isindex and form requests and data, see URL parameters or isindex data.

Examples

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.

See also