$Web_Selps

From m204wiki
Revision as of 21:33, 21 February 2011 by 198.242.244.47 (talk) (Created page with "{{DISPLAYTITLE:$Web_Selps}} <span class="pageSubtitle"><section begin="desc" />Build select options from delimited list of strings, selected from parameters<section end="desc" />...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<section begin="desc" />Build select options from delimited list of strings, selected from parameters<section end="desc" />


$Web_Selps inserts into the Web output stream the options list of an HTML<select> element. The options list is taken from two arguments which are delimited lists of strings, and the selected options (that is, the ones that are highlighted on the HTML page) are identified by values of a form and/or isindex parameter in the current web request. An overview of the $WEB_SEL_x functions is provided in $Web_Selp.

$Web_Selps takes four arguments and always returns null, unless an error occurs, in which case the current User Language request is cancelled. It is a callable $function (see Calling Sirius Mods $functions).

Syntax

<section begin="syntax" /> %RC = $Web_Selps(delimited_vals, delimited_descrs, - param_name, option_keywords) <section end="syntax" />





delimited_vals A string containing a delimited list of strings which are the values for the options list. The first character of this argument is the delimiter that separates the values. The string should not contain a trailing delimiter unless you want the null string as the final value, which is unlikely. This is a required argument.
delimited_descrs A string containing a delimited list of strings which are the descriptions for the options list. The first character of this argument is the delimiter that separates the descriptions. The string should not contain a trailing delimiter unless you want the null string as the final description, which is unlikely. This is an optional argument; if omitted, the description of each generated option is identical to its value.
param_name The name of a form and/or an index parameter in the current web request. For each occurrence of this parameter, if it has a value which is equal to the value of an item in the options list, that option element is selected in the displayed options list; this allows multiple items to be selected, which is useful for <select&thinsp.multiple> elements. This an optional argument. If this argument is omitted, or if no occurrences of the parameter are equal to any of the values, then none of the <option> elements in the list contain the selected attribute. As explained in $Web_Selp, the default selected option depends on the type of <select> element: <select&thinsp.multiple> has no default; for non-multiple, the first item in the options list is the default selected element.
option_keywords
A string of blank-separated keywords specifying special processing for this $function; it can contain any of the following:
NOFORM Don't look in form parameters
NOISINDEX Don't look in isindex parameters
NOISI Synonym for NOISINDEX
NOENDSEL Don't end list of options with </select>
NOENDS Synonym for NOENDSEL
ENDOPT End each option with </option>


This an optional argument.

Code Meaning
null The operation completed successfully.
Any error results in cancellation of the User Language request.

$WEB_SELPS return values


For example, the following statement places a <select> element, which contains the Italian days of the week, into the web response output. The current value of the DN form parameter determines which of these days is selected:

%RC = $Web_Selps('/Domenica/Lunedi/Martedi' WITH - '/Mercoledi/Giovedi/Venerdi/Sabato', - '/DN0/DN1/DN2/DN3/DN4/DN5/DN6', 'DN')


See $Web_Selp for an extended example using other $WEB_SELx functions.

$Web_Selps and $Web_Selsp are synonyms.