CS Trüter
PHP Calendar Documentation
version 1.0

Back

Example 2 - Form Example

<html> <head> <title>Calendar Example 2</title> (1) <script language="javascript" src="js/calendar.js"></script> <link rel="stylesheet" type="text/css" href="styles/calendar.css" /> </head> <body> <form method="POST"> <? include "includes/PHP4/calendar.php"; $calendar = new Calendar("example2"); (2) $calendar->inForm = true; echo $calendar->Output(); ?> <input type="submit" /> </form> </body> </html>
Description

When containing the Calendar object inside a form, you'll need to do the following:
(1) Include the javascript file called calendar.js (you'll find in the js folder), to your head tag, this file eliminates postbacks and server interaction

(2) You will need to set the inForm property to true, this tells the component, that we're using it inside a form.

More than one Calendar?

What happens when we want more than one calendar on a page? Well, we simply instantiate a second object and specify a different ID for that object - and we're ready for launch.

DUH

When using the object inside a form, insure that you place it within the form tags, else you wont get any value back from your control.

Interesting

Its interesting to note, what happens to the Microsoft ASP.net calendar component (and a few of the others) when one disables javascript, it stops functioning!

Luckily you wont have the problem here, when Javascript is disabled, the server intervenes, and the calendar keeps functioning.