Calendars, date-pickers, and your birthday!


Post #: 69
Post type: Blog post
Date: 2012-11-27 15:14:43.000
Author: Rocket Man

Happy Birthday! Or is it?

It's handy in web applications to have a way to select dates in a rigid format, and to have a little calendar to make it easier for users to select dates. I've incorporated a plugin for Bootstrap that does just that.

Inside a form, just use the following code:

(form-datepicker "Enter your birth date" "date" show-birthdate "dp1")

This will open up a little form box where you can type in a date, or if you click on the date box a calendar pops up.

To see it in action, go to your User Profile page (click on your name on the upper right) and you can set your birthdate there! At some point I'll add a little feature that will send you a Happy Birthday email, just for fun.

When I was implementing this I discovered that SQLite wants dates in a YYYY-MM-DD HH:MM:SS.000 format and this calendar wants it in MM-DD-YYYY format. It's quite easy to convert between the two, but I might add some date functions to Rockets to make this easier. Of course everyone has their own preferred date format, which complicates things still further...


xerxes on 2012-11-28 13:09:23.000

I admire this work: it just gets better. Congratulations.

I am not experienced in newLISP: how is this accomplished without using CGI? Or am I wrong, and there is a CGI somewhere ... I didn't find one.

Rocket Man on 2012-11-28 13:33:32.000

Thanks!

Rockets is currently running on Apache. In the /sites-enabled/ directory, I've configured the root directory to use CGI:


AddHandler cgi-script .lsp
<Directory "/var/www">
Options ExecCGI Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>


So any files with the .lsp extension are executed as CGI. The first line of each .lsp file must contain:

#!/usr/bin/env newlisp

in order to run the newLISP interpreter.

Rocketeer on 2012-11-28 13:55:06.000

Works for me.

xerxes on 2012-11-28 20:22:35.000

Thanks for the explanation. I'll try to figure out how to make this run on Windows (I have two PCs: an Ubuntu & a Win 7, both 64 Bit). The Ubuntu installation should run as you say (I haven't yet tried), but I am unsure yet of how Win 7 will handle the scripts.

ralph-moeritz on 2012-11-28 23:31:33.000

Rockets looks very cool indeed. Is there FastCGI support?

Rocket Man on 2012-11-29 10:45:25.000

Hi ralph, for FastCGI see my response in the other thread :)

xerxes, I haven't tested running Rockets on Windows. In theory you can run both Apache and newLISP on Windows as well as configure CGI apps (I once ran a webserver on Windows XP running Apache and PHP) but it might take a bit of fiddling. A Linux (Ubuntu is what I use) server is definitely recommended.

View this post in the forums

Views: 5490