$Web Selp: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Selp}}
{{DISPLAYTITLE:$Web_Selp}}
<span class="pageSubtitle"><section begin="desc" />Build select options from global select element, selected from parameters<section end="desc" /></span>
<span class="pageSubtitle">Build select options from global select element, selected from parameters</span>




Line 6: Line 6:
<var>$Web_Selp</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 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 [[Janus Web Server $functions#$Web_Sel* functions|"$Web_Sel* functions"]].  
<var>$Web_Selp</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 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 [[Janus Web Server $functions#$Web_Sel* functions|"$Web_Sel* functions"]].  


<var>$Web_Selp</var> takes three arguments and returns a string; for some types of errors, the current <var class="product">User Language</var> request is cancelled. <var>$Web_Selp</var> is a callable $function (see [[Calling_Sirius_Mods_$functions|"Calling Sirius Mods $functions"]]).
<var>$Web_Selp</var> takes three arguments and returns a string; for some types of errors, the current <var class="product">User Language</var> request is cancelled. <var>$Web_Selp</var> is a [[Calling Sirius Mods $functions|callable]] $function.


==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %rc = $Web_Selp(global_name, [param_name], [option_keywords])
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$Web_Selp</span>(<span class="term">global_name</span>, [<span class="term">param_name</span>], [<span class="term">option_keywords</span>])
<section end="syntax" /></p>
</p>


<table class="syntaxTable">
<table class="syntaxTable">
Line 51: Line 51:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>Code</th>
<tr><th>Code</th>
<td>Meaning</td></tr>
<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>
<tr><th>"1"</th>
<tr><th>"1"</th>
<td><var class="term">Global_name</var> not a saved global select element, and <var>NOCAN</var> option specified.</td>
<td><var class="term">global_name</var> not a saved global select element, and <var>NOCAN</var> option specified.</td>
<tr><th></th>
<tr><th></th>
<td>Any other error results in cancellation of the <var class="product">User Language</var> request.</td></tr>
<td>Any other error results in cancellation of the <var class="product">User Language</var> request.</td></tr>

Latest revision as of 21:45, 5 June 2013

Build select options from global select element, selected from parameters


$Web_Selp 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 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_Sel* functions".

$Web_Selp takes three arguments and returns a string; for some types of errors, the current User Language request is cancelled. $Web_Selp is a callable $function.

Syntax

%rc = $Web_Selp(global_name, [param_name], [option_keywords])

%rc A numeric variable to contain the return 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.
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 that 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 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 select element: <select multiple> has no default; for non-multiple, the first item in the options list is the default selected element.

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:
NOCAN Don't cancel request if global select element global_name not found
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>

These are the $Web_Selp return values:

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.

See "$Web_Sel* example" for an extended example which includes use of $Web_Selp.