Issue with Ctrl-F
2005/02/01 22:54
Viewed 15880 times
Replies: 0/0

Hi,

This calendar is awesome, really cool stuff. But I am having an issue in IE6 having this calendar.
Steps to recreate:

1. Go to a page with the calendar displayed
2. Do Ctrl-F and search for any word. Hit Find Next
3. IE crashes. I have to kill it from Task Manager.

What is causing IE to crash? How to get around it ? I could reproduce this in multiple machines, both with XP and Win2K

Thanks

danerles

last
Re: compare dates
2005/02/07 14:13
Viewed 15468 times
Replies: 0/0

Does nobody has an idea?

last
Re: compare dates
2006/02/06 02:06
Viewed 11699 times
Replies: 0/0

Greetings Jens,

have you been able to solve the problem of user selectring earlier dates?
Would you share the solution?

All the best
Walter Conti

last
bug??
2005/02/07 18:12
Viewed 12652 times
Replies: 0/0

I have a text box with a date in it and am using that date as the default value for the calendar when it pops up (using the "date" parameter of calendar.setup). I have a button that pops up the calendar. The first time I click the button, everything works fine. But if I close the calendar and then click the button again to open it up, I get "Object doesn't support this property or method". The error is in the Calendar.prototype.setDate function on the line "if (!date.equalsTo(this.date)) {". I have the cache property set to true when I get this error and noticed that if I set it to false, the error does not occur.

To recreate:
1. Put a text input on a page with a date in it and add a button to pop up the calendar using the date in the text input as the default date. Make sure "cache" is set to true.

2. Click the button to open the calendar. The calendar pops up fine with the correct date selected.

3. Close the calendar and click the button again to open it up. You should get the error described above.

4. Now set "cache" to false and repeat the same steps. The error will not occur.

last
PHP 5
2005/02/24 20:40
Viewed 13269 times
Replies: 0/0

I have incorporated the calendar into a project that requires all code be PHP 5. So, I updated calendar.php to follow PHP 5 protocols. Basically, I just changed the constructor to be __construct, and I made all the vars and functions public or protected as seemed appropriate.

FYI, I was implementing this in a system with multiple calendars per page potentially. So, I instantiated a calendar at the top of the page to include the JavaScript in the document head. Then I instantiated more calendars as needed further down the page when the form field type called for a date. Something like:

<head>
<?php
$cal = new DHTML_Calendar();
$cal->load_files();
?>
</head>
<body>
....
<form>
<?php
echo('<input name="' . $elemName . '" id="' . $elemName . '" type="text">');
echo('<img src="/img/calendar.gif" border="0" id="trigger_' . $elemName . '">');

${$elemName . '_options'} = array();
${$elemName . '_options'}['inputField'] = $elemName;
${$elemName . '_options'}['ifFormat'] = '%Y-%m-%dT%H:%M:%SZ';
${$elemName . '_options'}['showsTime'] = true;
${$elemName . '_options'}['timeFormat'] = '24';
${$elemName . '_options'}['button'] = 'trigger_'.$elemName;


${$elemName . '_calendar'} = new DHTML_Calendar();
echo ${$elemName . '_calendar'}->_make_calendar(${$elemName . '_options'});
?>
</form>

As long as the variable $elemName is unique, you can plop in dozens of calendars in a single form.

Here is the revised code for calendar.php:

<?php

/**
* File: calendar.php | (c) dynarch.com 2004
* Distributed as part of "The Coolest DHTML Calendar"
* under the same terms.
* -----------------------------------------------------------------
* This file implements a simple PHP wrapper for the calendar. It
* allows you to easily include all the calendar files and setup the
* calendar by instantiating and calling a PHP object.
*/

define('NEWLINE', "\n");

class DHTML_Calendar {
public $calendar_lib_path;

public $calendar_file;
public $calendar_lang_file;
public $calendar_setup_file;
public $calendar_theme_file;
public $calendar_options;

public function __construct($calendar_lib_path = '/includes/jscalendar/',
$lang = 'en',
$theme = 'calendar-win2k-1',
$stripped = true) {
if ($stripped) {
$this->calendar_file = 'calendar_stripped.js';
$this->calendar_setup_file = 'calendar-setup_stripped.js';
} else {
$this->calendar_file = 'calendar.js';
$this->calendar_setup_file = 'calendar-setup.js';
}
$this->calendar_lang_file = 'lang/calendar-' . $lang . '.js';
$this->calendar_theme_file = $theme.'.css';
$this->calendar_lib_path = preg_replace('/\/+$/', '/', $calendar_lib_path);
$this->calendar_options = array('ifFormat' => '%Y/%m/%d',
'daFormat' => '%Y/%m/%d');
}

public function set_option($name, $value) {
$this->calendar_options[$name] = $value;
}

public function load_files() {
echo $this->get_load_files_code();
}

public function get_load_files_code() {
$code = ( '<link rel="stylesheet" type="text/css" media="all" href="' .
$this->calendar_lib_path . $this->calendar_theme_file .
'" />' . NEWLINE );
$code .= ( '<script type="text/javascript" src="' .
$this->calendar_lib_path . $this->calendar_file .
'"></script>' . NEWLINE );
$code .= ( '<script type="text/javascript" src="' .
$this->calendar_lib_path . $this->calendar_lang_file .
'"></script>' . NEWLINE );
$code .= ( '<script type="text/javascript" src="' .
$this->calendar_lib_path . $this->calendar_setup_file .
'"></script>' );
return $code;
}

public function _make_calendar($other_options = array()) {
$js_options = $this->_make_js_hash(array_merge($this->calendar_options, $other_options));
$code = ( '<script type="text/javascript">Calendar.setup({' .
$js_options .
'});</script>' );
return $code;
}

public function make_input_field($cal_options = array(), $field_attributes = array()) {
$id = $this->_gen_id();
$attrstr = $this->_make_html_attr(array_merge($field_attributes,
array('id' => $this->_field_id($id),
'type' => 'text')));
echo '<input ' . $attrstr .'/>';
echo '<a href="#" id="'. $this->_trigger_id($id) . '">' .
'<img align="middle" border="0" src="' . $this->calendar_lib_path . 'img.gif" alt="" /></a>';

$options = array_merge($cal_options,
array('inputField' => $this->_field_id($id),
'button' => $this->_trigger_id($id)));
echo $this->_make_calendar($options);
}

/// PRIVATE SECTION

protected function _field_id($id) { return 'f-calendar-field-' . $id; }
protected function _trigger_id($id) { return 'f-calendar-trigger-' . $id; }
protected function _gen_id() { static $id = 0; return ++$id; }

protected function _make_js_hash($array) {
$jstr = '';
reset($array);
while (list($key, $val) = each($array)) {
if (is_bool($val))
$val = $val ? 'true' : 'false';
else if (!is_numeric($val))
$val = '"'.$val.'"';
if ($jstr) $jstr .= ',';
$jstr .= '"' . $key . '":' . $val;
}
return $jstr;
}

protected function _make_html_attr($array) {
$attrstr = '';
reset($array);
while (list($key, $val) = each($array)) {
$attrstr .= $key . '="' . $val . '" ';
}
return $attrstr;
}
};

?>

Incidentally, I renamed the file to DHTML_Calendar.class.php, so that I could use the auto-loader feature in PHP 5 without having to specifically include the class file. If you haven't read up on auto-loader, you should. It's a very convenient function of PHP 5.

I hope all of this is helpful to someone. Enjoy!

Arthur

last
JS calendar works then it stops??
2005/02/25 21:56
Viewed 12268 times
Replies: 0/0

My JS calendar uses a MS SQL 2000 database to store dates in this format 2/25/2005. The date column was initially set up as varchar (10) and JS calendar worked like a charm. Then the date column was switched to datetime (8) and only the year 2005 will run or date and year as 25 2005 will run. How can I enter a date formated like 2/25/2005 into the datetime(8) field? Any help would be greatly appreciated.

last
Entering no date
2005/03/08 14:51
Viewed 12660 times
Replies: 3/6

How can we use jscalendar when we have a "not required" date input field.

Opening the calendar and closing wil not create an input in the field but what can we do if we want to change from "existing date" to "no date" up to now you have to use the keyboard to eleminate the date string.
Is there another way to clean the input ?
Have we overseen something in the docu :-(

Using the keyboard is not really what we want. As setting the focus via mouse will again popup a calendar.

A additional button for "no date" would be cool !

thanks

Gero

BTW: I'm planning to integrate jscalendar as a optional input method for dates into TUTOS http://www.tutos.org

last
Re: Entering no date
2005/03/09 07:56
Viewed 15482 times
Replies: 1/2

The current version doesn't have such an option; we'll add this feature in the next version, as an optional parameter.

last
Add a date clearing button beside calendar
2005/03/21 06:49
Viewed 14779 times
Replies: 1/1

Add the following to your form:

<input type=button value="Clear Date" onClick="document.forms.fieldname.value=''"></div>

Several things should be pointed out for those less familiar to javascript:
1) Your form obviously has to be named; in the above case the form would have a name value of "forms" (<form method="POST" name="forms" action="postpage.htm">)
2) "fieldname" is the name of your date input field
3) the value should look like this, but without any spaces: onClick="document.forms.fieldname.value=' ' ">
- So the value following the equal sign is two single-quotes followed by a double-quote -- no spaces between any of them. I wrote it out this way, because it's difficult to tell the difference between single and double quotes on this forum.

Now you should be able to make your input field read-only, while still giving the user to clear the date out entirely by passing an empty value via the about onclick command. It's a stop-gap approach, at least until the dev team adds it directly to the calendar. ;-)

last
Re: Entering no date
2008/05/07 09:34
Viewed 2082 times
Replies: 0/0

Are there any news regarding this problem? Having a "no date" button would be great! Reasons for that are already mentioned in this thread..
Thanks a lot!

last
Month Buttons
2005/03/09 21:48
Viewed 11619 times
Replies: 0/0

Hi,

Ive implemented Month buttons on the calendar, however I am having trouble calling a function that will change the month to the desired month. The date is going to an input textbox that postsback onblur. So I dont want to change information in the textbox until an actual date is clicked or enter is pressed on a date.

If you need more information, just ask.

Thanks,

Brian

last
Two calendars in one form?
2005/03/10 02:13
Viewed 11868 times
Replies: 0/0

I have a form for an event calendar that has a field for start date and another for end date. How can I instantiate two instances of the calendar for each form field within a single form?

last
Form with 2 textfields
2005/03/10 11:11
Viewed 12143 times
Replies: 1/3

Hi!

This is a great calendar. I´m very happy that I´ve found it. But I have a couple of problems/questions with it.

1.
In my form I want to have one textfield to display date and another textfield to display time.
How can I fill the two textfields with values from the calendar??

2.
I´ve changed the language file to "calendar-sv.js" (swedish) but it doesn´t work. In fact only english language file works.

Please help me with these two issues.

last
Re: Form with 2 textfields
2005/07/08 16:34
Viewed 13469 times
Replies: 1/2

Excellent product!!!!

I have the exact same situation as described by Danne. I have the date on one form field and the time in another. How can I hook jscalendar to populate both form fields upon selection?

Thanks,

AJ

last
Making dates unselectable
2005/03/15 07:41
Viewed 12382 times
Replies: 1/2

I am currently attempting to utilize your calendar popup to fill in a online appointment booking form. I have customized the calendar to fit my specific needs sans one request. My appointment dates are ALWAYS full for around 7 days from the current date. I would like to make every date up to and including 7 days past the current date unselectable. Is there a way to do this? I have seen other popup calendars do this somehow but am not sure they are dhtml. Any help with the code would be appreciated. I was thinking I could work around this problem by creating a function that would add 7 days to the current date and display an alert if the user selects a date that is not far enough in advance but I would really like to make them unselectable (simular to weekend days) Thanks again...

last
Google