<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://m204wiki.rocketsoftware.com/index.php?action=history&amp;feed=atom&amp;title=%24Web_Sel%2A_example</id>
	<title>$Web Sel* example - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://m204wiki.rocketsoftware.com/index.php?action=history&amp;feed=atom&amp;title=%24Web_Sel%2A_example"/>
	<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=$Web_Sel*_example&amp;action=history"/>
	<updated>2026-05-01T01:03:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=$Web_Sel*_example&amp;diff=48719&amp;oldid=prev</id>
		<title>JALWiccan: 1 revision</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=$Web_Sel*_example&amp;diff=48719&amp;oldid=prev"/>
		<updated>2012-10-18T21:53:32Z</updated>

		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:53, 18 October 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>JALWiccan</name></author>
	</entry>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=$Web_Sel*_example&amp;diff=48718&amp;oldid=prev</id>
		<title>JAL2: Created page with &quot;This page demonstrates some of the concepts of the $Web_Sel* functions. The application is a simple form which lets the user select a day of the week. To show how this can exploi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=$Web_Sel*_example&amp;diff=48718&amp;oldid=prev"/>
		<updated>2012-10-18T21:53:28Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page demonstrates some of the concepts of the $Web_Sel* functions. The application is a simple form which lets the user select a day of the week. To show how this can exploi...&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:53, 18 October 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l89&quot;&gt;Line 89:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 89:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following approach can be used to handle this situation&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following approach can be used to handle this situation&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;when the web form is built.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;when the web form is built.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the &amp;lt;var&amp;gt;NOCAN&amp;lt;/var&amp;gt; option of $Web_Selp is used to see if a new language&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the &amp;lt;var&amp;gt;NOCAN&amp;lt;/var&amp;gt; option of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;var&amp;gt;&lt;/ins&gt;$Web_Selp&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/var&amp;gt; &lt;/ins&gt;is used to see if a new language&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;is in use:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;is in use:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Begin&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Begin&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JAL2</name></author>
	</entry>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=$Web_Sel*_example&amp;diff=48717&amp;oldid=prev</id>
		<title>JAL2: Created page with &quot;This page demonstrates some of the concepts of the $Web_Sel* functions. The application is a simple form which lets the user select a day of the week. To show how this can exploi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=$Web_Sel*_example&amp;diff=48717&amp;oldid=prev"/>
		<updated>2011-09-20T19:48:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page demonstrates some of the concepts of the $Web_Sel* functions. The application is a simple form which lets the user select a day of the week. To show how this can exploi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page demonstrates some of the concepts of the $Web_Sel* functions.&lt;br /&gt;
The application is a simple form which lets the user select a day of&lt;br /&gt;
the week.&lt;br /&gt;
To show how this can exploit metadata, assume that you have a &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model 204&amp;lt;/var&amp;gt;&lt;br /&gt;
file with the days of the week in several languages, and that you have saved&lt;br /&gt;
the user&amp;#039;s language in a cookie named &amp;lt;code&amp;gt;LANG&amp;lt;/code&amp;gt;.&lt;br /&gt;
Note that by giving values of &amp;lt;code&amp;gt;DN0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DN1&amp;lt;/code&amp;gt;, etc., the code does not&lt;br /&gt;
need to deal with the actual day names (the option descriptions).&lt;br /&gt;
 &lt;br /&gt;
Assume you have records like the following:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;IN META STORE RECORD&lt;br /&gt;
TYPE = LANG&lt;br /&gt;
LANG = ENGLISH&lt;br /&gt;
END STORE&lt;br /&gt;
 &lt;br /&gt;
IN META STORE RECORD&lt;br /&gt;
TYPE = DAY&lt;br /&gt;
LANG = ENGLISH&lt;br /&gt;
DAY = Sunday&lt;br /&gt;
END STORE&lt;br /&gt;
IN META STORE RECORD&lt;br /&gt;
TYPE = DAY&lt;br /&gt;
LANG = ENGLISH&lt;br /&gt;
DAY = Monday&lt;br /&gt;
END STORE&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;var&amp;gt;[[$Web_Save_Sel]]&amp;lt;/var&amp;gt; is used to save one global select element for each language.&lt;br /&gt;
You can do this when you start the online, but a later example shows how a&lt;br /&gt;
language can be dynamically added.&lt;br /&gt;
Assume the following procedure:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;PROCEDURE GEN_DAYS&lt;br /&gt;
SUBROUTINE GEN_DAYS(%LANG IS STRING LEN 20, -&lt;br /&gt;
%NDAY IS FLOAT OUTPUT)ut)&lt;br /&gt;
%NDAY = 0&lt;br /&gt;
%L1 FLOAT&lt;br /&gt;
%L2 FLOAT&lt;br /&gt;
%X FLOAT&lt;br /&gt;
%L1 = $LISTNEW&lt;br /&gt;
%L2 = $LISTNEW&lt;br /&gt;
IN META FR WHERE TYPE=DAY AND LANG=%LANG&lt;br /&gt;
   %X = $LISTADD(%L1, &amp;#039;DAY&amp;#039; WITH %NDAY)&lt;br /&gt;
   %X = $LISTADD(%L2, DAY)&lt;br /&gt;
   %NDAY = %NDAY + 1&lt;br /&gt;
END FOR&lt;br /&gt;
IF %NDAY THEN&lt;br /&gt;
   %x = $WEB_SAVE_SEL(&amp;#039;DAYS.&amp;#039; WITH %LANG, -&lt;br /&gt;
DEL&lt;br /&gt;
      %L1, %L2)&lt;br /&gt;
END IF&lt;br /&gt;
END SUBROUTINE&lt;br /&gt;
END PROC&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
You can use this procedure at the start of the online:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;//CCAIN ...&lt;br /&gt;
 ...&lt;br /&gt;
BEGIN&lt;br /&gt;
IN META FR WHERE TYPE=LANG&lt;br /&gt;
   CALL GEN_DAYS(LANG, %RC)&lt;br /&gt;
END FOR&lt;br /&gt;
INCLUDE GEN_DAYS&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
You can use the global select elements to create a drop-down list in an&lt;br /&gt;
HTML form.&lt;br /&gt;
&amp;lt;var&amp;gt;[[$Web_Selp]]&amp;lt;/var&amp;gt; is used with the same second argument (the parameter&lt;br /&gt;
name, &amp;lt;code&amp;gt;DN&amp;lt;/code&amp;gt;) as the &amp;lt;code&amp;gt;name=&amp;lt;/code&amp;gt; attribute of the &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; element; this is&lt;br /&gt;
how you can easily &amp;quot;pre-select&amp;quot; the same day chosen before when the&lt;br /&gt;
form is redisplayed to the user:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;B&lt;br /&gt;
%lang string len 20&lt;br /&gt;
%rc float&lt;br /&gt;
%lang = $web_cookie_parm(&amp;#039;LANG&amp;#039;)&lt;br /&gt;
print &amp;#039;&amp;lt;form method=post action=&amp;quot;&amp;#039; with -&lt;br /&gt;
   $web_hdr_parm(&amp;#039;URL&amp;#039;) with&amp;#039;&amp;quot;&amp;gt;&amp;#039;&lt;br /&gt;
print &amp;#039;Select day: &amp;lt;select name=DN&amp;gt;&amp;lt;br&amp;gt;&amp;#039;&lt;br /&gt;
%RC = $web_selp(&amp;#039;DAYS.&amp;#039; with %lang, &amp;#039;DN&amp;#039;)&lt;br /&gt;
print &amp;#039;&amp;lt;input type=submit&amp;gt;&amp;lt;br&amp;gt;&amp;#039;&lt;br /&gt;
print &amp;#039;&amp;lt;/form&amp;gt;&amp;#039;&lt;br /&gt;
End&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
This approach works fine, except that if a language is added while&lt;br /&gt;
the online is running, a user who acquires this language in his or&lt;br /&gt;
her cookie will have the &amp;lt;var&amp;gt;User Language&amp;lt;/var&amp;gt; request cancelled, because&lt;br /&gt;
&amp;lt;var&amp;gt;$Web_Selp&amp;lt;/var&amp;gt; will not find the desired global select element.&lt;br /&gt;
The following approach can be used to handle this situation&lt;br /&gt;
when the web form is built.&lt;br /&gt;
the &amp;lt;var&amp;gt;NOCAN&amp;lt;/var&amp;gt; option of $Web_Selp is used to see if a new language&lt;br /&gt;
is in use:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Begin&lt;br /&gt;
%lang string len 20&lt;br /&gt;
%rc float&lt;br /&gt;
%lang = $web_cookie_parm(&amp;#039;LANG&amp;#039;)&lt;br /&gt;
print &amp;#039;&amp;lt;form method=post action=&amp;quot;&amp;#039; with -&lt;br /&gt;
   $web_hdr_parm(&amp;#039;URL&amp;#039;) with &amp;#039;&amp;quot;&amp;gt;&amp;#039;&lt;br /&gt;
print &amp;#039;Select day: &amp;lt;select name=DN&amp;gt;&amp;lt;br&amp;gt;&amp;#039;&lt;br /&gt;
%rc = $web_selp(&amp;#039;DAYS.&amp;#039; with %lang, &amp;#039;DN&amp;#039;, -&lt;br /&gt;
   &amp;#039;NOCAN&amp;#039;)&lt;br /&gt;
if %rc ne 0 then&lt;br /&gt;
   call gen_days(%lang, %rc)&lt;br /&gt;
   %rc = $web_selp(&amp;#039;DAYS.&amp;#039; with %lang, &amp;#039;DN&amp;#039;)&lt;br /&gt;
end if&lt;br /&gt;
print &amp;#039;&amp;lt;input type=submit&amp;gt;&amp;lt;br&amp;gt;&amp;#039;&lt;br /&gt;
print &amp;#039;&amp;lt;/form&amp;gt;&amp;#039;&lt;br /&gt;
include gen_days&lt;br /&gt;
End&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
If you want to remove a language from further processing, you can&lt;br /&gt;
call &amp;lt;var&amp;gt;[[$Web_Del_Sel]]&amp;lt;/var&amp;gt;:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Begin&lt;br /&gt;
%rc = $web_del_sel(&amp;#039;DAYS.ESPERANTO&amp;#039;)&lt;br /&gt;
End&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
However, it is then possible that a &amp;quot;stale cookie&amp;quot; may be left&lt;br /&gt;
around in a user&amp;#039;s browser.&lt;br /&gt;
In that case, you will want to set a default language,&lt;br /&gt;
but if the deleted language was Romulac, and a day beyond the 7th&lt;br /&gt;
had been selected, you might also want to force&lt;br /&gt;
the pre-selected day to be the middle of the week.&lt;br /&gt;
The following code contains changes that do the following:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a default language (with &amp;lt;var&amp;gt;[[$Web_Set_Cookie]]&amp;lt;/var&amp;gt;)&lt;br /&gt;
&amp;lt;li&amp;gt;Use &amp;lt;var&amp;gt;[[$Web_Selp_Check]]&amp;lt;/var&amp;gt; to ensure that the user&amp;#039;s form parameter &amp;lt;var&amp;gt;DN&amp;lt;/var&amp;gt;&lt;br /&gt;
(which, remember, will contain the language-independent values &amp;lt;code&amp;gt;DN0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DN1&amp;lt;/code&amp;gt;, etc.)&lt;br /&gt;
is within the range of the default language.&lt;br /&gt;
If &amp;lt;var&amp;gt;DN&amp;lt;/var&amp;gt; is outside that range,&lt;br /&gt;
&amp;lt;var&amp;gt;$Web_Sel&amp;lt;/var&amp;gt; is used so that the pre-selected day is the &amp;quot;hand-coded&amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;DN3&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;B&lt;br /&gt;
%lang string len 20&lt;br /&gt;
%rc float&lt;br /&gt;
%lang = $web_cookie_parm(&amp;#039;LANG&amp;#039;)&lt;br /&gt;
print &amp;#039;&amp;lt;form method=post action=&amp;quot;&amp;#039; with -&lt;br /&gt;
   $web_hdr_parm(&amp;#039;URL&amp;#039;) with &amp;#039;&amp;quot;&amp;gt;&amp;#039;&lt;br /&gt;
print &amp;#039;Select day: &amp;lt;select name=DN&amp;gt;&amp;lt;br&amp;gt;&amp;#039;&lt;br /&gt;
%rc = $web_selp(&amp;#039;DAYS.&amp;#039; with %lang, &amp;#039;DN&amp;#039;, -&lt;br /&gt;
   &amp;#039;NOCAN&amp;#039;)&lt;br /&gt;
if %rc ne 0 then&lt;br /&gt;
   call gen_days(%lang, %rc)&lt;br /&gt;
   if %rc ne 0 then&lt;br /&gt;
      %lang = &amp;#039;ENGLISH&amp;#039;&lt;br /&gt;
      %rc = $web_set_cookie(&amp;#039;LANG&amp;#039;, &amp;#039;ENGLISH&amp;#039;)&lt;br /&gt;
   end if&lt;br /&gt;
   %rc = $web_selp_check(&amp;#039;DAYS.&amp;#039; with %lang, -&lt;br /&gt;
      &amp;#039;DN&amp;#039;)&lt;br /&gt;
   if %rc ne 0 then&lt;br /&gt;
      %rc = $web_sel(&amp;#039;DAYS.&amp;#039; with %lang, &amp;#039;DN3&amp;#039;)&lt;br /&gt;
   else&lt;br /&gt;
      %rc = $web_selp(&amp;#039;DAYS.&amp;#039; with %lang, &amp;#039;DN&amp;#039;)&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
print &amp;#039;&amp;lt;input type=submit&amp;gt;&amp;lt;br&amp;gt;&amp;#039;&lt;br /&gt;
print &amp;#039;&amp;lt;/form&amp;gt;&amp;#039;&lt;br /&gt;
include gen_days&lt;br /&gt;
End&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Janus Web Server]]&lt;/div&gt;</summary>
		<author><name>JAL2</name></author>
	</entry>
</feed>