$Web Sel: Difference between revisions
mNo edit summary |
m (→Syntax) |
||
(25 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Web_Sel}} | {{DISPLAYTITLE:$Web_Sel}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Build select options from global select element, selected is string</span> | ||
$Web_Sel inserts into the Web output stream the options list of an HTML<select> element. The options list is taken from a global select element created by $ | <var>$Web_Sel</var> inserts into the Web output stream the options list of an HTML <code><select></code> element. The options list is taken from a global select element created by <var>$Web_Save_Sel</var>, and the selected option (that is, the one that is highlighted on the HTML page) is specified by a character string. An overview of the $Web_Sel* functions is provided in <var>[[$Web_Selp]]</var>. | ||
<var>$Web_Sel</var> is a [[Calling_Sirius_Mods_$functions|callable]] $function. | |||
< | |||
< | |||
$Web_Sel is | <var>$Web_Sel</var> takes three arguments and returns a string; for some types of errors, the current <var class="product">User Language</var> request is cancelled. | ||
$Web_Sel | ==Syntax== | ||
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$Web_Sel</span>(<span class="term">global_name</span>, [<span class="term">selected_value</span>], [<span class="term">option_keywords</span>]) | |||
</p> | |||
===Syntax terms=== | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>global_name</th> | <tr><th>global_name</th> | ||
<td>The name of the global select element containing the values and descriptions for the options list. The global select element with this name must have been created by $Web_Save_Sel. This is a required argument.</td></tr> | <td>A [[#Status codes|status code]]. | ||
<tr><th>global_name</th> | |||
<td>The name of the global select element containing the values and descriptions for the options list. The global select element with this name must have been created by <var>$Web_Save_Sel</var>. This is a required argument.</td></tr> | |||
<tr><th>selected_value</th> | <tr><th>selected_value</th> | ||
<td>A string which, if equal to one of the values in the options list, specifies the item that is selected in the displayed options list. This does not allow multiple item selection in a "select multiple" element. This an optional argument. If this argument is omitted, or if the string is not equal to the value of any of the options in the global select element, then none of the "option" elements in the list contain the '''selected''' attribute. As explained in [[Janus Web Server $functions#Drop-down lists: HTML <select>|"Drop-down lists: HTML <select>"]], the default selected option depends on the type of <select> element: <select multiple> has no default; for non-multiple, the first item in the options list is the default selected element.</td></tr> | <td>A string which, if equal to one of the values in the options list, specifies the item that is selected in the displayed options list. This does not allow multiple item selection in a "select multiple" element. | ||
<p> | |||
This an optional argument. If this argument is omitted, or if the string is not equal to the value of any of the options in the global select element, then none of the "option" elements in the list contain the '''selected''' attribute. </p> | |||
<p> | |||
As explained in [[Janus Web Server $functions#Drop-down lists: HTML <select>|"Drop-down lists: HTML <select>"]], 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> | <td>This optional argument is a string of blank-separated keywords specifying special processing for this $function. Any of the following is valid: | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>NOCAN</th> | <tr><th><var>NOCAN</var></th> | ||
<td>Don't cancel request if ''global_name'' not found</td></tr> | <td>Don't cancel request if ''global_name'' not found</td></tr> | ||
<tr><th>NOENDSEL</th> | <tr><th><var>NOENDSEL</var></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><var>NOENDS</var></th> | ||
<td>Synonym for NOENDSEL</td></tr> | <td>Synonym for NOENDSEL</td></tr> | ||
<tr><th>ENDOPT</th> | <tr><th><var>ENDOPT</var></th> | ||
<td>End each option with </option> | <td>End each option with <code></option></code> | ||
</td></tr></table> | </td></tr></table> | ||
</td></tr> | </td></tr> | ||
</table> | </table> | ||
===Status codes=== | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>Code</th> | <tr><th>Code</th> | ||
< | <th>Meaning</th></tr> | ||
<tr><th>null</th> | <tr><th>null</th> | ||
<td>The operation completed successfully.</td></tr> | <td>The operation completed successfully.</td></tr> | ||
Line 41: | Line 50: | ||
<td>''Global_name'' not a saved global select element, and NOCAN option specified. </td></tr> | <td>''Global_name'' not a saved global select element, and NOCAN option specified. </td></tr> | ||
<tr><th></th> | <tr><th></th> | ||
<td>Any other error results in cancellation of the User Language request.</td></tr> | <td>Any other error results in cancellation of the <var class="product">User Language</var> request.</td></tr> | ||
</table> | </table> | ||
See [[$Web_Selp]] for an extended example which includes use of $Web_Sel. | ==Examples== | ||
See <var>[[$Web_Selp]]</var> for an extended example which includes use of <var>$Web_Sel</var>. | |||
[[Category:Janus Web Server $functions|$Web_Sel]] | [[Category:Janus Web Server $functions|$Web_Sel]] |
Latest revision as of 21:42, 5 June 2013
Build select options from global select element, selected is string
$Web_Sel inserts into the Web output stream the options list of an HTML <select>
element. The options list is taken from a global select element created by $Web_Save_Sel, and the selected option (that is, the one that is highlighted on the HTML page) is specified by a character string. An overview of the $Web_Sel* functions is provided in $Web_Selp.
$Web_Sel is a callable $function.
$Web_Sel takes three arguments and returns a string; for some types of errors, the current User Language request is cancelled.
Syntax
%rc = $Web_Sel(global_name, [selected_value], [option_keywords])
Syntax terms
global_name | A status code. | ||||||||
---|---|---|---|---|---|---|---|---|---|
global_name | The name of the global select element containing the values and descriptions for the options list. The global select element with this name must have been created by $Web_Save_Sel. This is a required argument. | ||||||||
selected_value | A string which, if equal to one of the values in the options list, specifies the item that is selected in the displayed options list. This does not allow multiple item selection in a "select multiple" element.
This an optional argument. If this argument is omitted, or if the string is not equal to the value of any of the options in the global select element, then none of the "option" elements in the list contain the selected attribute.
As explained in "Drop-down lists: HTML <select>", the default selected option depends on the type of | ||||||||
option_keywords | This optional argument is a string of blank-separated keywords specifying special processing for this $function. Any of the following is valid:
|
Status codes
Code | Meaning |
---|---|
null | The operation completed successfully. |
1 | Global_name not a saved global select element, and NOCAN option specified. |
Any other error results in cancellation of the User Language request. |
Examples
See $Web_Selp for an extended example which includes use of $Web_Sel.