Forum: Rails Spinoffs (closed, excessive spam) Prototype datepicker

Posted by louis w (Guest)
on 2008-06-18 23:45
(Received via mailing list)
Looking for recommendations on date pickers which use prototype.

I found this one:
http://www.eulerian.com/en/opensource/datepicker-p...
But it has some positioning issues in Safari.

Thanks.
Posted by Hector Virgen (Guest)
on 2008-06-19 00:11
(Received via mailing list)
I wrote one not too long ago that uses prototype. It's not too advanced
but makes for a decent date-chooser. It has an onSelect() hook that
fires when a day is clicked, and allows you to cycle through
next/previous months.

If you want to check it out you can test it here (just click the little
calendar icon).

http://www.realtown.com/sandbox/calendar

I know it can be improved but this was just a quick thing I put together
for one of our admins.

Here's the JS script, written as a plugin (only requirement is 
prototype).

http://www.realtown.com/js/realtown/plugins/calendar.js

When used, the plugin automatically loads this stylesheet:

http://www.realtown.com/css/calendar.css

Here's the javascript snippet that is used to add the calendar icon next
to the date field:

<script type="text/javascript">
<!--

var img = $(document.createElement('img'));
img.setAttribute('src', '/images/icons/calendar.png');
img.setAttribute('id', 'calendar-button');
img.setAttribute('class', 'icon');
img.setAttribute('alt', 'Date Selector');
img.style.cursor = 'pointer';
$('mdy').appendChild(img);

img.observe('click', function(event) {
    date = new Date();
    date.setMonth($('month').value - 1);
    date.setDate($('day').value);
    date.setYear($('year').value);
    var calendar = new RT.calendar({
        selected: date,
        onSelect:   function(date)
        {
            $('month').value = date.getMonth() + 1;
            $('day').value = date.getDate();
            $('year').value = date.getFullYear();
        }
    });
    var container = calendar.getCalendar();
    var position = $('calendar-button').cumulativeOffset();
    container.style.top = position.top + 'px';
    container.style.left = position.left + 'px';
});

//-->
</script>
Posted by darrin (Guest)
on 2008-06-19 03:12
(Received via mailing list)
haven't personally used any of these, but http://scripteka.com/ is a
good place to start for prototype/scriptaculous extensions.
Posted by T.J. Crowder (Guest)
on 2008-06-19 09:32
(Received via mailing list)
Diodeus mentioned this one in another thread just yesterday:
http://www.frequency-decoder.com/2006/10/02/unobtr...
Said he uses it for all his date inputs.

FWIW.
--
T.J. Crowder
tj / crowder software / com
Posted by louis w (Guest)
on 2008-06-19 15:33
(Received via mailing list)
Thanks everyone for the recs, I will check it out.

Hector, is your script free to hack up? I want to use one input field
and add observers.
Posted by louis w (Guest)
on 2008-06-19 16:24
(Received via mailing list)
Thanks everyone for the recs, I will check it out.

Hector, is your script free to hack up? I want to use one input field
and add observers.
Posted by louis w (Guest)
on 2008-06-19 16:24
(Received via mailing list)
Hmm. The ZIP on the Frequency decoder site seems to be corrupt.
Whenever I download it and open it can not unarchive. Wonder if it's a
mac issue.
http://www.frequency-decoder.com/2006/10/02/unobtr...
Posted by Frederick Polgardy (Guest)
on 2008-06-19 17:06
(Received via mailing list)
Hmm, I can see it fine on a Mac.  You're downloading this right?

http://www.frequency-decoder.com/demo/date-picker-...

-Fred

On Thu, Jun 19, 2008 at 9:24 AM, louis w <louiswalch@gmail.com> wrote:

>
> Hmm. The ZIP on the Frequency decoder site seems to be corrupt.
> Whenever I download it and open it can not unarchive. Wonder if it's a
> mac issue.
>
> http://www.frequency-decoder.com/2006/10/02/unobtr...



--
Science answers questions; philosophy questions answers.
Posted by Hector Virgen (Guest)
on 2008-06-19 17:47
(Received via mailing list)
Yea, you should be able to make it work with a single input field. It
accepts and returns native Date() objects, so it's just a matter of
converting that to something your form can handle in a single field.

It currently accepts on an observer by defining onSelect() on
construction. Unfortunately I don't have any documentation for it but it
if you have any questions just shoot me an email.

Basic usage:

var date = new Date();
var handleSelect = function(date)
{
    // Do something with date
}
var calendar = new RT.calendar(
{
    selected: date,
    onSelect:   handleSelect
});

-Hector
Posted by nlloyds (Guest)
on 2008-06-19 17:49
(Received via mailing list)
On Jun 18, 4:44 pm, louis w <louiswa...@gmail.com> wrote:
> Looking for recommendations on date pickers which use prototype.

This one works well: http://code.google.com/p/calendardateselect/

Nathan
Posted by louis w (Guest)
on 2008-06-19 19:16
(Received via mailing list)
Yup, downloading that one. This is what I keep getting. (I tried it 3
times)
http://skitch.com/louiswalch/qbcm/stuffit-expander
Posted by darrin (Guest)
on 2008-06-19 20:41
(Received via mailing list)
I've had files in the past that stuffit has had issues with, but were
able to be extracted with the command line tools.
Posted by Frederick Polgardy (Guest)
on 2008-06-19 22:04
(Received via mailing list)
I never use StuffIt unless it just automatically downloads and does it 
for
me. :-)  I always use zip/unzip on the cmd line.  Call me an old-school 
Unix
guy. ;-)

-Fred

On Thu, Jun 19, 2008 at 1:40 PM, darrin <darrin.holst@gmail.com> wrote:

>
> I've had files in the past that stuffit has had issues with, but were
> able to be extracted with the command line tools.
>
> On Jun 19, 12:15 pm, louis w <louiswa...@gmail.com> wrote:
> > Yup, downloading that one. This is what I keep getting. (I tried it 3
> > times)http://skitch.com/louiswalch/qbcm/stuffit-expander
>

--
Science answers questions; philosophy questions answers.
Posted by kalle saas (Guest)
on 2008-06-20 12:44
(Received via mailing list)
hey,
i build one for myself. try it if you like:

http://kallesaas.com/projects/microdateselect/

feedback is welcome ;)

regards,
kalle

web: www.kallesaas.com






Am 18.06.2008 um 23:44 schrieb louis w:
This topic is locked and can not be replied to.