PHP Classes

Doesn't quite work

Recommend this page to a friend!

      PHP date picker class  >  All threads  >  Doesn't quite work  >  (Un) Subscribe thread alerts  
Subject:Doesn't quite work
Summary:A few bugs make it not work properly
Messages:3
Author:Pierre Paquette
Date:2006-08-26 17:41:25
Update:2009-09-11 10:22:28
 

  1. Doesn't quite work   Reply   Report abuse  
Picture of Pierre Paquette Pierre Paquette - 2006-08-26 17:41:25
The pop-up window appears with the calendar inside (though it doesn't fit n the default-size window), and when I click on a date, it closes and writes the right date in the input field, there's no problem here.

However, when I click on another month or another year, it refreshes the same window, there's no change. For example I'm still in August 2006.

Windows XP, Apache 2.0.5, PHP 5.1.5, Firefox 1.5

Pierre Paquette
pierre@pierrepaquette.net
http://pierrepaquette.net

  2. Re: Doesn't quite work   Reply   Report abuse  
Picture of Anders Wallman Anders Wallman - 2009-09-11 10:11:46 - In reply to message 1 from Pierre Paquette
After half an hour of reading code I found the bug.

In includes/datepicker.php:
Remove or comment the commented lines (19, 20, 30, 31) in the following snippet:

<?php

error_reporting(E_ALL);

// the very first time, all properties are set through GET and so we need
// to convert them to POSTs as we'll be using that from that moment on
if (
isset($_GET["preselectedDate"]) &&
isset($_GET["month"]) &&
isset($_GET["year"]) &&
isset($_GET["controlName"]) &&
isset($_GET["dateFormat"]) &&
isset($_GET["firstDayOfWeek"]) &&
isset($_GET["clearDateButton"]) &&
isset($_GET["language"]) &&
isset($_GET["template"])
) {
$_POST["preselectedDate"] = $_GET["preselectedDate"];
19 //$_POST["month"] = $_GET["month"];
20 //$_POST["year"] = $_GET["year"];
$_POST["controlName"] = $_GET["controlName"];
$_POST["dateFormat"] = $_GET["dateFormat"];
$_POST["firstDayOfWeek"] = $_GET["firstDayOfWeek"];
$_POST["clearDateButton"] = $_GET["clearDateButton"];
$_POST["language"] = $_GET["language"];
$_POST["template"] = $_GET["template"];
}
if (
isset($_POST["preselectedDate"]) &&
30 //isset($_POST["month"]) &&
31 //isset($_POST["year"]) &&
isset($_POST["controlName"]) &&
isset($_POST["dateFormat"]) &&
isset($_POST["firstDayOfWeek"]) &&
isset($_POST["clearDateButton"]) &&
isset($_POST["language"]) &&
isset($_POST["template"])
) {

Cheers Anders

  3. Re: Doesn't quite work   Reply   Report abuse  
Picture of Anders Wallman Anders Wallman - 2009-09-11 10:22:28 - In reply to message 2 from Anders Wallman
Another bug found and fixed in the same file:

Original row: $daysFromPreviousMonth = ($cmp < 0 ? 7 - $cmp : $cmp);

Corrected row: $daysFromPreviousMonth = ($cmp < 0 ? 7 + $cmp : $cmp);

Cheers Anders