Versions

CalendarView2.fwaction (2013-01-22) (Downloaded 180 times)

Contains:

  • CalendarView2 (item-action) - v. 0.1

Compatible: Pro 4, Pro 5, Pro 5.5, and Pro 6

Author: Walter Davis

developer form server prototype variable open-source lgpl date-and-time

This is a new version of CalendarView, updated under the hood to streamline your page and make it load faster.

Apply this Action to a text field to make an easy popup calendar for choosing dates. Based on http://calendarview.org and includes Prototype.js.

Your text field may either be blank, or be pre-filled with a date. The date will be interpreted if present, and the popup calendar will center on that date. (You may always navigate to a different month or year.) If the field is blank, then the calendar will default to the current date. When you click on a date in the calendar, the chosen date will be entered into your text field.

Date Formatting

There is a text field in the Action interface to configure the date format. By default, this is set to an ISO-formatted date, as MySQL and other databases understand that natively. If your form processor expects a different format, or you just want to be nice to your visitors, then you may construct your own format string. Here’s the list of acceptable format tokens:

%a = abbreviated weekday name
%A = full weekday name
%b = abbreviated month name
%B = full month name
%C = the century number
%d = the month (range 01 to 31)
%e = the day of the month (range 1 to 31)
%H = hour, range 00 to 23 (24h format)
%I = hour, range 01 to 12 (12h format)
%j = day of the year (range 001 to 366)
%k = hour, range 0 to 23 (24h format)
%l = hour, range 1 to 12 (12h format)
%m = month, range 01 to 12
%M = minute, range 00 to 59
%n = a newline character
%p = uppercase AM or PM
%P = lowercase am or pm
%S = seconds, range 00 to 59
%t = a tab character
%U = week number
%u = the day of the week (range 1 to 7, 1 = MON)
%w = the day of the week (range 0 to 6, 0 = SUN)
%y = year without the century (range 00 to 99)
%Y = year with the century
%% = a literal '%' character

Anything which is not on this list will appear “in the clear” – without any substitution taking place. You may use any punctuation you like within the date in order to make it easier to read.

Whatever date format you choose, you have to be consistent with it all the way through. If you pre-fill your date form element with a date, it must conform to the same format as you set here.

License Information

The underlying calendar formatter is licensed with the GNU LGPL (Lesser General Public License). While considerably more lax than the GPL (a.k.a. CopyLeft), this license still requires you to divulge certain information whenever you sell a product including licensed material. If this is a concern to you or anyone purchasing a site from you, you have been warned. You may read more about the license at the GNU Project.

2 Comments

Hi Walter I am going to use the CalendarView for a booking form for a dining pub in the City of London. It doesn't open on Saturdays and Sundays - just week days. Is there any way to make it so the dates that fall on a Sunday or Saturday cannot be clicked - not active? I appreciate your help Thanks Paul

Hi Walter I have a similar problem to Paul, but my calendar shows all the days except Sundays. IE just a 6 day week. Can this be changed to include Sundays? Thanks David

Sign In or Sign Up to comment.