$Web Parm Num Line: Difference between revisions
m (1 revision) |
m (→Syntax) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Web_Parm_Num_Line}} | {{DISPLAYTITLE:$Web_Parm_Num_Line}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Number form or isindex field</span> | ||
<var>$Web_Parm_Num_Line</var> retrieves the number of lines in an isindex or form field. It is especially useful for ''textarea'' input fields. <var>$Web_Num_Line</var> is a short synonym for <var>$Web_Parm_Num_Line</var>. | <var>$Web_Parm_Num_Line</var> retrieves the number of lines in an isindex or form field. It is especially useful for ''textarea'' input fields. <var>$Web_Num_Line</var> is a short synonym for <var>$Web_Parm_Num_Line</var>. | ||
Line 7: | Line 7: | ||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%string</span> = $Web_[Parm_]Num_Line( <span class="term">fieldname, occurrence</span> ) | ||
< | </p> | ||
===Syntax terms=== | ===Syntax terms=== |
Latest revision as of 22:04, 5 June 2013
Number form or isindex field
$Web_Parm_Num_Line retrieves the number of lines in an isindex or form field. It is especially useful for textarea input fields. $Web_Num_Line is a short synonym for $Web_Parm_Num_Line.
$Web_Parm_Num_Line takes two arguments and returns either the number of lines in the isindex or form field or a 0 indicating either that there were no lines in the isindex or form field or that some other error has occurred. Possible errors would be the isindex or form field not being found or the function being invoked on a non-web server thread.
Syntax
%string = $Web_[Parm_]Num_Line( fieldname, occurrence )
Syntax terms
fieldname | The name of the isindex or form field, returned by $Web_Name. Required argument if occurrence not specified, otherwise optional. |
---|---|
occurrence | The occurrence number of a isindex or form field, or the occurrence number of the isindex or form field matching 'fieldname', if fieldname is specified. Optional argument if fieldname is specified, otherwise it is required. |
Usage notes
- A line is considered to be a block of text that is terminated by either an ASCII carriage return (X'0D') or a carriage return followed by a line feed (X'0A'). This is what is ordinarily sent by a browser to mark the end of each line of a textarea input field.
- $Web_Parm_Num_Line first looks for isindex fields matching the name, then for form fields. $Web_Parm_Num_Line can be used instead of $Web_IsIndex_Parm_Num_Line and $Web_Form_Parm_Num_Line to make it easy to switch between using "method=GET" and "method=POST"
<form>
tags and simply to save typing.
Examples
This example checks if the number of lines returned in a textarea exceeds the size of the array meant to hold the input from the textarea.
%LINES = $Web_Parm_Num_Line('COMMENTS') IF %LINES GT %MAXLINES THEN AUDIT 'Maximum lines exceeded for ' WITH - $Web_Hdr_Parm('request') WITH - ' - input will be truncated' %LINES = %MAXLINES END IF