Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date time picker

Status
Not open for further replies.

cwolgamott

Programmer
May 29, 2002
69
US
Hello. :) I am creating an asp page where I would like the user to be able to pick a date through a datetime picker. I created the page and am able to use the datetime picker when I run it from my page on my computer. However, when I try to upload the page to our intranet, the datetime picker will not allow you to select any dates and will only allow you to go backwards, not forwards. Here is the code that I found on the internet that I am using:

Strval = Request.ServerVariables("HTTP_USER_AGENT")
If (Instr(1, Strval, &quot;MSIE&quot;, 1) <> 0) Then
%>
<!-- Popup Calendar Stuff -->
<IFRAME STYLE=&quot;display:none;position:absolute;width:148;height:194;z-index=100&quot; ID=&quot;CalFrame&quot; MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE FRAMEBORDER=0 SCROLLING=NO SRC=&quot;cal/calendar.htm&quot;></IFRAME>
<SCRIPT LANGUAGE=&quot;javascript&quot; SRC=&quot;/gleapps/helpdesk/cal/calendar.js&quot;></SCRIPT>
<SCRIPT FOR=document EVENT=&quot;onclick()&quot;>
<!--
document.all.CalFrame.style.display=&quot;none&quot;;
//-->
</SCRIPT>
<!-- END Popup Calendar Stuff -->
<%
End If
%>
<!-- The Value statement is optional. Only if you want to show a date in the box before choice -->
<INPUT class=text3 maxLength=12 name=date1 size=9 value=&quot;<%= FormatDateTime(now(),2)%>&quot;>
<!-- the following if statement checks to make sure the user is using IE -->
<%
Strval = Request.ServerVariables(&quot;HTTP_USER_AGENT&quot;)
If (Instr(1, Strval, &quot;MSIE&quot;, 1) <> 0) Then
%>
<!-- Popup Calendar Stuff
the arguments are like this
function(form field,date to highlight,null, date to start at, date to end at)
dates before the start and after the end cannot be selected.
it is possible to change the function to only allow dates before a given date
it's in calendar.htm change the to a greater than sign
in this line: if(i<iBox) {s=&quot;baddate.gif&quot;;n=&quot;bdt&quot;;}
currently, it is set so that you can select anything starting with today <%= FormatDateTime(now(),2)%>
and ending one year from now <%= FormatDateTime(DateAdd(&quot;yyyy&quot;, 1, now()),2)%> just change those
two lines below if you want to include other dates. This code does not work with netscape. -->
<A href=&quot;javascript:ShowCalendar(document.formfest.dateimg1,document.formfest.date1,null, '<%= FormatDateTime(DateAdd(&quot;yyyy&quot;, 0, now()),2)%>', '<%= FormatDateTime(DateAdd(&quot;yyyy&quot;, 1, now()),2)%>')&quot; onclick=event.cancelBubble=true;><IMG align=top border=0 height=21 id=dateimg1 src=&quot;/gleapps/helpdesk/cal/calendar.gif&quot; style=&quot;POSITION: relative&quot; width=34></A>
<%
End If
%>
<!-- END Popup Calendar Stuff -->

I would greatly appreciate any suggestions. :) Thank you. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top