[rp_timemenu]

Description

Link: [rp_timemenu]
Author: Randy Phillips
Category: Date
Version: 8.x
License: Public Domain
Posted: Dec. 07, 2005
Updated: Jan. 16, 2006
More by this author...
This tag outputs hour, minutes and seconds pulldown menus in html forms.

Parameters

-hourlabel string, optional This optional parameter is the name of the label for the hour select menu in the html form.
-minutelabel string, optional This optional parameter is the name of the label for the mintue select menu in the html form.
-secondlabel string, optional This optional parameter is the name of the label for the second select menu in the html form.
-hourname string, required This required parameter is the name of the hour select menu in the html form.
-secondname string, optional This optional parameter is the name of the seconds select menu in the html form.
-minutename string, required This required parameter is the name of the minute select menu in the html form.
-ampm_name string, optional This optional parameter is the name of the AM/PM select menu in the html form.
-minute_interval integer, optional The optional paramter allows the minute menu to be configured in desired intervals.
-hourformat string, required This required parameter accepts either 'standard' or 'military' time.
-selecthour string, optional This optional parameter takes the value of the hour output from a database column.
-selectminute string, optional This optional parameter takes the value of the minute output from a database column.
-selectampm string, optional This optional parameter takes the value of the AM/PM output from a database column.
-selectedsecond string, optional This optional parameter takes the value of the seconds output from a database column.
-encodenone optional This parameteris optional but required for the tag to output the form elements. It can be removed for debugging.

Sample Usage

<form>
[rp_timemenu: 
			-hourlabel='Start Hours', 
			-minutelabel='Start Minutes', 
			-secondlabel='Start Seconds',
			-hourname='shrs', 
			-minutename='smins',
			-secondname='ssecs', 
			-ampm_name='sampm',
			-hourformat='standard',
			-minute_interval=15, 
			-selecthour=(action_param:'shrs'),
			-selectminute=(action_param:'smins'),
			-selectsecond=(action_param:'ssecs'),
			-selectampm=(action_param:'sampm'),
			-encodenone]
</form>
						

Source Code

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?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;
?>

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net