Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.
<?LassoScript
/*
Author: Randy Phillips
Company: phillipsIT
Date: 11/21/2005
LP8 Version
This tag outputs hour, minutes and seconds pulldown menus in html forms.
The optional -hourlabel parameter is the name of the label for the hour select menu in the html form
The optional -minutelabel parameter is the name of the label for the mintue select menu in the html form
The optional -secondlabel parameter is the name of the label for the second select menu in the html form
The required -hourname parameter is the name of the hour select menu in the html form
The optional -secondname parameter is the name of the seconds select menu in the html form
The required -minutename parameter is the name of the minute select menu in the html form
The optional -ampm_name parameter is the name of the AM/PM select menu in the html form
The optional -minute_interval paramter allows the minute menu to be configured in desired intervals
The required -hourformat parameter accepts either 'standard' or 'military' time
The optional -selecthour parameter takes the value of the hour output from a database column
The optional -selectminute parameter takes the value of the minute output from a database column
The optional -selectampm parameter takes the value of the AM/PM output from a database column
The optional -selectedsecond parameter takes the value of the seconds output from a database column
The -encodenone parameter is required for this tag to output the form elements. It can be removed for debugging.
*/
define_tag:'TimeMenu', -namespace='RP_',
-optional='hourlabel',
-optional='minutelabel',
-optional='secondlabel',
-required='hourname',
-required='minutename',
-optional='secondname',
-optional='ampm_name',
-required='hourformat',
-optional='minute_interval',
-optional='selecthour',
-optional='selectminute',
-optional='selectampm',
-optional='selectsecond';
if: !(local_defined:'hourlabel');
local:'hourlabel' = 'Hours';
/if;
if: !(local_defined:'minutelabel');
local:'minutelabel' = 'Minutes';
/if;
if: !(local_defined:'secondlabel');
local:'secondlabel' = 'Seconds';
/if;
//------ select hour formatting
select: #hourformat;
case: 'standard';
local: 'hours' = 12;
case: 'military';
local: 'hours' = 23;
/select;
if: (local_defined:'minute_interval');
local:'ticks' = 60 / #minute_interval;
else;
local:'ticks' = 60;
local:'minute_interval' = 1;
/if;
//------ add hour menu to output
local: 'output' = '<select name="' + #hourname + '" class="menu">\r<option value="">' + #hourlabel + '</option>\r';
if: #hourformat == 'military';
#output += '<option value="00"'; if: (local_defined:'selecthour') && #selecthour == '00'; #output += ' selected'; /if; #output += '>00</option>\r';
/if;
loop: #hours;
local: 'hour_value' = (loop_count);
#hour_value->(setformat: -padding=2, -padchar='0');
if: (local_defined:'selecthour') && #selecthour == #hour_value;
#output += '<option value="' + #hour_value + '" selected>' + #hour_value + '</option>\r';
else;
#output += '<option value="' + #hour_value + '">' + #hour_value + '</option>\r';
/if;
/loop;
#output += '</select>';
//------ add minute menu to output
#output += ':<select name="' + #minutename + '" class="menu">\r<option value="">' + #minutelabel + '</options>\r';
#output += '<option value="00"'; if: (local_defined:'selectminute') && #selectminute == '00'; #output += ' selected'; /if; #output += '>00</option>\r';
loop: #ticks;
local:'mins' = #minute_interval * (loop_count);
if:#mins != 60;
if: (local_defined:'selectminute') && #selectminute == #mins;
#output += '<option value="' + #mins + '" selected>' + #mins + '</option>\r';
else;
#output += '<option value="' + #mins + '">' + #mins + '</option>\r';
/if;
/if;
/loop;
#output += '</select>';
//------- add seconds menu to output
if: (local_defined:'secondname');
#output += ':<select name="' + #secondname + '" class="menu">\r<option value="">' + #secondlabel + '</options>\r';
#output += '<option value="00"'; if: (local_defined:'selectsecond') && #selectsecond == '00'; #output += ' selected'; /if; #output += '>00</option>\r';
loop: 59;
local:'sex' = (loop_count);
#sex->(setformat: -padding=2, -padchar='0');
if: (local_defined:'selectsecond') && #selectsecond == #sex;
#output += '<option value="' + #sex + '" selected>' + #sex + '</option>\r';
else;
#output += '<option value="' + #sex + '">' + #sex + '</option>\r';
/if;
/loop;
#output += '</select>';
/if;
//--------- add AM/PM to output
if: (local_defined:'ampm_name') && #hourformat == 'standard';
#output += ' am <input name="' + #ampm_name + '" type="radio" value="AM"'; if: (#selectampm) == 'am'; #output += ' checked'; /if;
#output += '> pm <input name="' + #ampm_name + '" type="radio" value="PM"'; if: (#selectampm) == 'pm'; #output += ' checked'; /if; #output += '>\r';
/if;
return:#output;
/define_tag;
?>