View Full Version : loop for date
crmpicco
06-30-2005, 02:45 PM
<select name="date">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
how can i build this is a loop,
i.e. for 1 to 31 do this.....
instead of having to code <option>1</option>
<option>2</option>
<option>3</option>
<option>4</option> and so on....
Brandoe85
06-30-2005, 02:49 PM
Try:
dim i
For i = 1 to 31
Response.write "<option>" & i & "</option>"
Next
crmpicco
06-30-2005, 03:18 PM
<select name="date<%=k%>" style="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;">
<%
For d = 1 to 31
Response.write "<option>" & d & "</option>"
Next
%>
</select>
<select name="month<%=k%>" style="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;">
<%
For m = 1 to 12
response.Write "<option>" & MMtoMMM(m) & "</option>"
Next
%>
</select>
<%
Dim three_years_ago
three_years_ago = year(date) - 3
%>
<select name="year" style="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;">
<%
For y = three_years_ago to year(date)
response.write "<option>" & y & "</option>"
Next
%>
</select>
Thanks, I have this code now. How do i change the date list to 0-28 when FEB is selected? Or 0-30 when APR is selected and so on? I'm sure this can be done. But how? Any ideas?
Brandoe85
06-30-2005, 03:31 PM
With javascript, unless you want a page refresh, search the javascript forum and i'm sure you'll find plenty of examples....
http://www.codingforums.com/showthread.php?t=61396
crmpicco
06-30-2005, 03:37 PM
<input type="hidden" name="dobinum<%=k%>">
How do i make the value of the text box all the values of the SELECTED drop-downs added toegther,
i.e. D-MMM-YYYY
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.