Hi,
I'm currently working on an ASP wabsite where the user is able to adjust date and time of a post with a dropdown list. Everyhting works, but I have some problems with the hour. For day, month and year I use this code, works perfect:
<select name="u_day" class="form_field"> <% for counter = 1 to 31 %> <option <% if counter = day(rsPosts.Fields.Item("PostDate").value) then %> selected <% end if %> value="<%= counter %>"> <%= counter %></option> <% next %> </select>
<select size="1" name="u_month" class="form_field"> <% for counter = 1 to 12 %> <option <% if counter = month(rsPosts.Fields.Item("PostDate").value) then %> selected <% end if %> value="<%= counter %>"><%= MonthName(counter) %></option> <% next %> </select>
<select size="1" name="u_year" class="form_field"> <% for counter = 2005 to 2010 %> <option <% if counter =year(rsPosts.Fields.Item("PostDate").value) then %> selected <% end if %> value="<%= counter %>"><%= counter %></option> <% next %> </select>
Now for the hour I'm using this
<select name="u_time" class="form_field"> <% for counter = 8 to 22 %> <option <% if counter = hour(rsPosts.Fields.Item("PostDate").value) then %> selected <% end if %> value="<%= counter %>:00:00"><%= counter %>:00:00</option> <% next %> </select>
I'malso using a javascript functio to get the dates from the fields
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" onSubmit="GetDate()">
the javascript GetDate():
<script language="JavaScript"> <!-- function GetDate() { document.form1.PostDate.value = document.form1.u_day.value + '/' + document.form1.u_month.value + '/' + document.form1.u_year.value + ' ' + document.form1.u_time.value; } //--> </script>
maybe I'm doing something wrong here
and the variables <% u_date=request.form("u_date") u_month=request.form("u_month") u_day=request.form("u_day") u_year=request.form("u_year") u_time=request.form("u_time") %>
If I choose 'edit post' the hour comes correct in the dropdown list, but when I choose update, even when I leave the current hour selected, it removes the hour in the DB date field, only the date get's updated and the time is deleted.
|