$Web Selps: Difference between revisions
mNo edit summary |
m (→Syntax) |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Web_Selps}} | {{DISPLAYTITLE:$Web_Selps}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Build select options from delimited list of strings, selected from parameters</span> | ||
<var>$Web_Selps</var> 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 $ | <var>$Web_Selps</var> inserts into the Web output stream the options list of an HTML <code><select></code> 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* functions is provided in <var>[[$Web_Selp]]</var>. | ||
<var>$Web_Selps</var> takes four arguments and always returns null, unless an error occurs, in which case the current <var class="product">User Language</var> request is cancelled. It is a [[Calling_Sirius_Mods_$functions|callable]] $function. | <var>$Web_Selps</var> takes four arguments and always returns null, unless an error occurs, in which case the current <var class="product">User Language</var> request is cancelled. It is a [[Calling_Sirius_Mods_$functions|callable]] $function. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%rc</span> = <span class="literal">$Web_Selps</span>(<span class="term">delimited_vals</span>, [<span class="term">delimited_descrs</span>], [<span class="term">param_name</span>], [<span class="term">option_keywords</span>]) | ||
< | </p> | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
Line 14: | Line 14: | ||
<td>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.</td></tr> | <td>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.</td></tr> | ||
<tr><th>delimited_descrs</th> | <tr><th>delimited_descrs</th> | ||
<td>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.</td></tr> | <td>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. | ||
<p> | |||
This is an optional argument; if omitted, the description of each generated option is identical to its value.</p></td></tr> | |||
<tr><th>param_name</th> | <tr><th>param_name</th> | ||
<td>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 | <td>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 <code><select multiple></code> elements. | ||
<p> | |||
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 <code><option></code> elements in the list contain the '''selected''' attribute. As explained in <var>[[$Web_Selp]]</var>, the default selected option depends on the type of <code><select></code> element: <code><select multiple></code> has no default; for non-multiple, the first item in the options list is the default selected element.</p></td></tr> | |||
<tr><th>option_keywords</th> | <tr><th>option_keywords</th> | ||
<td>This optional argument is a string of blank-separated keywords specifying special processing for this $function; it can contain any of the following: | <td>This optional argument is a string of blank-separated keywords specifying special processing for this $function; it can contain any of the following: | ||
Line 27: | Line 31: | ||
<td>Synonym for NOISINDEX</td></tr> | <td>Synonym for NOISINDEX</td></tr> | ||
<tr><th>NOENDSEL</th> | <tr><th>NOENDSEL</th> | ||
<td>Don't end list of options with </select></td></tr> | <td>Don't end list of options with <code></select></code></td></tr> | ||
<tr><th>NOENDS</th> | <tr><th>NOENDS</th> | ||
<td>Synonym for NOENDSEL</td></tr> | <td>Synonym for NOENDSEL</td></tr> | ||
<tr><th>ENDOPT</th> | <tr><th>ENDOPT</th> | ||
<td>End each option with </option> | <td>End each option with <code></option></code> | ||
</td></tr></table> | </td></tr></table> | ||
</td></tr></table> | </td></tr></table> | ||
Line 44: | Line 48: | ||
<td>Any error results in cancellation of the <var class="product">User Language</var> request.</td></tr> | <td>Any error results in cancellation of the <var class="product">User Language</var> request.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | |||
<ul> | |||
<li><var>$Web_Selps</var> and <var>$Web_Selsp</var> are synonyms. | |||
</ul> | |||
==Examples== | ==Examples== | ||
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: | <ol> | ||
<li>The following statement places a <code><select></code> 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: | |||
<p class="code">%rc = $Web_Selps('/Domenica/Lunedi/Martedi' WITH - | <p class="code">%rc = $Web_Selps('/Domenica/Lunedi/Martedi' WITH - | ||
Line 52: | Line 62: | ||
'/DN0/DN1/DN2/DN3/DN4/DN5/DN6', 'DN') | '/DN0/DN1/DN2/DN3/DN4/DN5/DN6', 'DN') | ||
</p> | </p> | ||
<li>See [[$Web_Selp]] for an extended example using other <var>$Web_Sel_xxx</var> functions. | |||
</ol> | |||
<li>See [[$Web_Selp]] for an extended example using other | |||
</ | |||
[[Category:Janus Web Server $functions|$Web_Selps]] | [[Category:Janus Web Server $functions|$Web_Selps]] |
Latest revision as of 21:48, 5 June 2013
Build select options from delimited list of strings, selected from parameters
$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* 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.
Syntax
%rc = $Web_Selps(delimited_vals, [delimited_descrs], [param_name], [option_keywords])
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 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_keywords | This optional argument is a string of blank-separated keywords specifying special processing for this $function; it can contain any of the following:
|
Return codes
Code | Meaning |
---|---|
null | The operation completed successfully. |
Any error results in cancellation of the User Language request. |
Usage notes
- $Web_Selps and $Web_Selsp are synonyms.
Examples
- 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_Sel_xxx functions.