•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 361,612 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,178 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 420 | Replies: 0 | Solved
![]() |
•
•
Join Date: Feb 2008
Posts: 135
Reputation:
Rep Power: 1
Solved Threads: 3
I have a small problem with this select box.
This one loops out [year-month] in 12 month periods starting from the current month. When a selection has been done, a month value is sended back to this select box so that the selected month then stays selected. That works, as long as the current month is NOT bigger than the ending month. If it's equal or bigger then it works.
Example:
--------------
2008-03 (Equal month as the ending month)
2008-04
2008-05
2008-06
2008-07
2008-08
2008-09
2008-10
2008-11
2008-12
2009-01 (Problem)
2009-02 (Problem)
2009-03 (Equal month as the starting month)
A value from the example cannot be used if the month value is smaller than the current month (2008-03).
This one loops out [year-month] in 12 month periods starting from the current month. When a selection has been done, a month value is sended back to this select box so that the selected month then stays selected. That works, as long as the current month is NOT bigger than the ending month. If it's equal or bigger then it works.
Example:
--------------
2008-03 (Equal month as the ending month)
2008-04
2008-05
2008-06
2008-07
2008-08
2008-09
2008-10
2008-11
2008-12
2009-01 (Problem)
2009-02 (Problem)
2009-03 (Equal month as the starting month)
A value from the example cannot be used if the month value is smaller than the current month (2008-03).
<select name="ymvalue" class="usermenuform" size="1" onchange="ymform.submit()">
<option value="0">- year / month -</option>
<%
Session("ym") = Request.Form("ymvalue")
YM = Session("ym")
a = date()
If YM <> "" Then
If YM > "0" Then
x = 1
For i = DatePart("m",a) To DatePart("m",Session("ym"))
x = x +1
Response.Write("<option value=" & Year(a)&"-"&Right("0" & Month(a),2) & " SELECTED >" & Year(a)&"-"&Right("0" & Month(a),2) & "-</option>")
a = DateAdd( "m", 1, a )
Next
x = x -1
For i = 0 To 12 -x
Response.Write("<option value=" & Year(a)&"-"&Right("0" & Month(a),2) & ">" & Year(a)&"-"&Right("0" & Month(a),2) & "-</option>")
a = DateAdd( "m", 1, a )
Next
End If
End If
If YM = "" OR YM = "0" Then
For i = 0 To 12
Response.Write("<option value=" & Year(a)&"-"&Right("0" & Month(a),2) & ">" & Year(a)&"-"&Right("0" & Month(a),2) & "-</option>")
a = DateAdd( "m", 1, a )
Next
End If
%>
</select>
Last edited by TobbeK : Mar 15th, 2008 at 2:11 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP Marketplace
Other Threads in the ASP Forum
- Previous Thread: inserting pictures in oracle using ASP
- Next Thread: ASP To Access


Linear Mode