Results 1 to 2 of 2

Thread: Jason's Date Input Calendar - how to start the calendar at a known date taken from DB

  1. #1
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Jason's Date Input Calendar - how to start the calendar at a known date taken from DB

    I'm writing an asp with connection to MS SQL Server 2000 and I would like to use this calendar ( http://www.dynamicdrive.com/dynamici...oncalendar.htm ) to input and update dates. I have some functions to initialize the date field which is to be submited and this is how I do it:

    HTML Code:
    <script>
    function getDatePicker() { 
        return this.form_name.orderdate.value;
     }
    
    function initDateOfCutOff() { 
        this.form_name.DateOfCutOff.value = getDatePicker();
     }
    </script>
    
    ...
    
    <input type="submit" class="btn" name="update" value="Save" onClick="initDateOfCutOff()">
    Here is the problem, this code works fine and initializes the calendar:

    HTML Code:
    <input type="hidden" name="oldDateOfCutOff" value="<%= details.Fields.Item("DateOfCutOff") %>">
    <script>DateInput('orderdate', false, 'MM/DD/YYYY', '11/24/2005')</script>
    <input type="hidden" name="DateOfCutOff">
    <input type="button" onClick="alert(this.form.oldDateOfCutOff.value.toString())" value="Show old date value">
    But the effect of this code is no calendar shown, although details.Fields.Item("DateOfCutOff") equals 11/24/2005:

    HTML Code:
    <input type="hidden" name="oldDateOfCutOff" value="<%= details.Fields.Item("DateOfCutOff") %>">
    <script>DateInput('orderdate', false, 'MM/DD/YYYY', this.form.oldDateOfCutOff.value.toString())</script>
    <input type="hidden" name="DateOfCutOff">
    <input type="button" onClick="alert(this.form.oldDateOfCutOff.value.toString())" value="Show old date value">
    The effect of this code is also no calendar shown:

    HTML Code:
    <input type="hidden" name="oldDateOfCutOff" value="11/24/2005">
    <script>DateInput('orderdate', false, 'MM/DD/YYYY', this.form.oldDateOfCutOff.value.toString())</script>
    <input type="hidden" name="DateOfCutOff">
    <input type="button" onClick="alert(this.form.oldDateOfCutOff.value.toString())" value="Show old date value">
    I'll be very thankful if you help me. Thank you in advance!
    Last edited by marulya; 11-04-2005 at 03:17 PM.

  2. #2
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I've solved this problem

    I just want to post the solution that worked for me:
    HTML Code:
    <%
    	if isnull(details("DateOfCutOff")) then
    %>
    	<script>DateInput('DateOfCutOff', true, 'MM/DD/YYYY')</script>
    <%
    	else
    %>
    	<script>DateInput('DateOfCutOff', true, 'MM/DD/YYYY', <% Response.Write("'" & details("DateOfCutOff") & "'") %>)</script>
    <%
    	end if
    %>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •