gradinumcp
IS-IT--Management
Hi! Here's my code which has 3 drop-down menus, one with Employee: which is fairly static, one with Month: and one with Date:. Once the user selects the Month, the date should dynamically show 31, 30... days based on the month chosen. Eg. 31 for January, 28 for February and so on. I got the code till here.
However once the month is chosen and the date menu is populated, the particular month does not show up on the menu. I want it to remain selected and remain displayed. Any clue???
I can tell you that earlier i was having problem with getting the Month value once the user selected it. So now i am getting that value with the onchange. However this basically redirects the user to the same page and sends additional data. But the old values vanish.
<form method=POST action=TimeEdit.asp name=Page1>
<table cellpadding=1 cellspacing=1 align=center border=0 width=100%>
<tr>
<td class=tabletd7 align=center>Select Employee: <select name=Employee class=fields>
<option value=''></option>
<% do while trl.eof<>true %>
<option <% if trl("autonum")=cint(request("Employee")) then %>selected<% end if %> value='<%=trl("autonum")%>'><%=trl("Fullname")%></option>
<% trl.movenext
loop %>
</select>
Month: <select name=Month class=fields onchange="window.open('TimeEdit.asp?Emp=<%=request("Employee")%>&MonthValue='+document.Page1.Month.value, target='main');">
<option value=''></option>
<option <% if request("Month")=1 then %>selected<% end if %> value='1'>January</option>
<option <% if request("Month")=2 then %>selected<% end if %> value='2'>February</option>
<option <% if request("Month")=3 then %>selected<% end if %> value='3'>March</option>
<option <% if request("Month")=4 then %>selected<% end if %> value='4'>April</option>
<option <% if request("Month")=5 then %>selected<% end if %> value='5'>May</option>
<option <% if request("Month")=6 then %>selected<% end if %> value='6'>June</option>
<option <% if request("Month")=7 then %>selected<% end if %> value='7'>July</option>
<option <% if request("Month")=8 then %>selected<% end if %> value='8'>August</option>
<option <% if request("Month")=9 then %>selected<% end if %> value='9'>September</option>
<option <% if request("Month")=10 then %>selected<% end if %> value='10'>October</option>
<option <% if request("Month")=11 then %>selected<% end if %> value='11'>November</option>
<option <% if request("Month")=12 then %>selected<% end if %> value='12'>December</option>
</select>
Day: <select name=Day class=fields>
<option value=''></option>
<% if request("MonthValue") =1 or request("MonthValue")=3 or request("MonthValue")=5 or request("MonthValue")=7 or request("MonthValue")=8 or request("MonthValue")=10 or request("MonthValue")=12 then %>
<%
x=1
do while x<=31 %>
<option <% if cint(request("Day"))=x then %>selected<% end if %> value='<%=x%>'><%=x%></option>
<% x=x+1
Loop %>
<% elseif request("MonthValue")=4 or request("MonthValue")=6 or request("MonthValue")=9 or request("MonthValue")=11 then %>
<%
x=1
do while x<=30 %>
<option <% if cint(request("Day"))=x then %>selected<% end if %> value='<%=x%>'><%=x%></option>
<% x=x+1
Loop %>
<% else if request("MonthValue") =2 then %>%>
<%
x=1
do while x<=28 %>
<option <% if cint(request("Day"))=x then %>selected<% end if %> value='<%=x%>'><%=x%></option>
<% x=x+1
Loop %>
<% end if %>
<% end if %>
</select>
type=button value="Submit" class=fields2 onclick="CheckVals();">
</td>
</tr>
</table>
</form>
However once the month is chosen and the date menu is populated, the particular month does not show up on the menu. I want it to remain selected and remain displayed. Any clue???
I can tell you that earlier i was having problem with getting the Month value once the user selected it. So now i am getting that value with the onchange. However this basically redirects the user to the same page and sends additional data. But the old values vanish.
<form method=POST action=TimeEdit.asp name=Page1>
<table cellpadding=1 cellspacing=1 align=center border=0 width=100%>
<tr>
<td class=tabletd7 align=center>Select Employee: <select name=Employee class=fields>
<option value=''></option>
<% do while trl.eof<>true %>
<option <% if trl("autonum")=cint(request("Employee")) then %>selected<% end if %> value='<%=trl("autonum")%>'><%=trl("Fullname")%></option>
<% trl.movenext
loop %>
</select>
Month: <select name=Month class=fields onchange="window.open('TimeEdit.asp?Emp=<%=request("Employee")%>&MonthValue='+document.Page1.Month.value, target='main');">
<option value=''></option>
<option <% if request("Month")=1 then %>selected<% end if %> value='1'>January</option>
<option <% if request("Month")=2 then %>selected<% end if %> value='2'>February</option>
<option <% if request("Month")=3 then %>selected<% end if %> value='3'>March</option>
<option <% if request("Month")=4 then %>selected<% end if %> value='4'>April</option>
<option <% if request("Month")=5 then %>selected<% end if %> value='5'>May</option>
<option <% if request("Month")=6 then %>selected<% end if %> value='6'>June</option>
<option <% if request("Month")=7 then %>selected<% end if %> value='7'>July</option>
<option <% if request("Month")=8 then %>selected<% end if %> value='8'>August</option>
<option <% if request("Month")=9 then %>selected<% end if %> value='9'>September</option>
<option <% if request("Month")=10 then %>selected<% end if %> value='10'>October</option>
<option <% if request("Month")=11 then %>selected<% end if %> value='11'>November</option>
<option <% if request("Month")=12 then %>selected<% end if %> value='12'>December</option>
</select>
Day: <select name=Day class=fields>
<option value=''></option>
<% if request("MonthValue") =1 or request("MonthValue")=3 or request("MonthValue")=5 or request("MonthValue")=7 or request("MonthValue")=8 or request("MonthValue")=10 or request("MonthValue")=12 then %>
<%
x=1
do while x<=31 %>
<option <% if cint(request("Day"))=x then %>selected<% end if %> value='<%=x%>'><%=x%></option>
<% x=x+1
Loop %>
<% elseif request("MonthValue")=4 or request("MonthValue")=6 or request("MonthValue")=9 or request("MonthValue")=11 then %>
<%
x=1
do while x<=30 %>
<option <% if cint(request("Day"))=x then %>selected<% end if %> value='<%=x%>'><%=x%></option>
<% x=x+1
Loop %>
<% else if request("MonthValue") =2 then %>%>
<%
x=1
do while x<=28 %>
<option <% if cint(request("Day"))=x then %>selected<% end if %> value='<%=x%>'><%=x%></option>
<% x=x+1
Loop %>
<% end if %>
<% end if %>
</select>
type=button value="Submit" class=fields2 onclick="CheckVals();">
</td>
</tr>
</table>
</form>