$Web Parm Line: Difference between revisions
m (1 revision) |
m (→Examples) |
||
Line 30: | Line 30: | ||
This example places each line of a textarea isindex or form field into an occurrence of a multiply occurring field. | This example places each line of a textarea isindex or form field into an occurrence of a multiply occurring field. | ||
<p class="code">FOR 1 RECORD IN ORDER_RECORD | <p class="code">FOR 1 RECORD IN ORDER_RECORD | ||
FOR %I FROM 1 TO $Web_Num_Line('COMMENTS') | FOR %I FROM 1 TO $Web_Num_Line('COMMENTS') | ||
%COMMENT = $Web_Line('COMMENTS', , %I) | %COMMENT = $Web_Line('COMMENTS', , %I) | ||
ADD COMMENT = %COMMENT | ADD COMMENT = %COMMENT | ||
END FOR | END FOR | ||
END FOR | END FOR | ||
</p> | </p> |
Revision as of 22:01, 15 June 2012
<section begin="desc" />Value of isindex or form field line<section end="desc" />
$Web_Parm_Line retrieves the value of a specific line in an isindex or form field. It is especially useful for textarea input fields. $Web_Line is a short synonym for $Web_Parm_Line.
$Web_Parm_Line takes three arguments and returns a string, or null for any error condition.
Syntax
<section begin="syntax" /> %STRING = $WEB_[PARM_]LINE( fieldname, occurrence, line_num ) <section end="syntax" />
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 an 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. |
line_num | Line number in the isindex or form field for which data is to be returned. This is an optional argument and defaults to 1. |
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 matching 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. - For a discussion of isindex or form requests and data, see "URL parameters or isindex data".
Examples
This example places each line of a textarea isindex or form field into an occurrence of a multiply occurring field.
FOR 1 RECORD IN ORDER_RECORD FOR %I FROM 1 TO $Web_Num_Line('COMMENTS') %COMMENT = $Web_Line('COMMENTS', , %I) ADD COMMENT = %COMMENT END FOR END FOR