CodeAve.com CodeAve.com - ASP - Server Variables
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Form Dates
There are a number of ways to have users input dates into your application.  Dropdown menus are the preferred method employed as there will certainly be less error checking on dropdown input as compared to textbox input.  Utilizing the date() functions the current date (or any date you prefer by adjusting the date value) can easily be made the pre-filled selected value.  The first of two examples displays the current date with a range of days prior. The second displays the current date out of all the dates in a range of years.
View the Output
Text View
Print View
Mail this Link
Download the Code

<html>
<title>CodeAve.com(DropDown Menu Dates)</title>
<body bgcolor="#FFFFFF">

<% 
' Requests all the form ekements that may be passed
u_date=request.form("u_date")
u_month=request.form("u_month")
u_day=request.form("u_day")
u_year=request.form("u_year")

' Checks to see if either form was submitted
if (u_month <> "") or (u_date <> "") then
%>
<center>You selected <br>
<% ' If the first form was selected display the user input
if (u_month <> "") then
response.write u_month & "/" & u_day & "/" & u_year
end if

' If the second form was selected display the user input
if (u_date <> "") then
response.write u_date
end if %>


<% ' If neither form is selected display two forms set to todays date 
else %>

<form action="<%= request.servervariables("script_name") %>" method="post">
<select size="1" name="u_date">
<% ' This loop will create a dropdown menu with the past ten days 
for counter = date()-10 to date() %> 

<option <% ' select the current date to display it
if counter = date() then %>
selected <%
end if %>
value="<%= counter %>"><%= counter %></option>
<% next %>
</select> 
<input type="submit">
</form>

<p>&nbsp;</p>
<p>&nbsp;</p>

<form action="<%= request.servervariables("script_name") %>" method="post">
<select size="1" name="u_month">
<% ' Start a loop to create the twelve months of the year 
for counter = 1 to 12 %> 

<option <% ' Select the current month to display
if counter = month(date()) then %>
selected <%
end if %>
value="<%= counter %>"><%= counter %></option>
<% next %>
</select> 

<select size="1" name="u_day">
<% ' Start a loop to create the days of the month 
for counter = 1 to 31 %> 

<option <% ' Select the current day to display
if counter = day(date()) then %>
selected <% 
end if %>
value="<%= counter %>"><%= counter %></option>
<% next %>
</select> 


<select size="1" name="u_year">
<% ' Start a loop to create the years prior and previous 
for counter = 1998 to 2005 %> 

<option <% ' Select the current year to display
if counter =year(date()) then %>
selected <%
end if %>
value="<%= counter %>"><%= counter %></option>
<% next %>
</select> 
<input type="submit">
<% end if %>


</body>
</html>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3