Search the web
Sign In
New User? Sign Up
ydn-javascript · Yahoo! User Interface Library Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Capturing date selected in the Calendar   Message List  
Reply | Forward Message #50387 of 52114 |
Re: Capturing date selected in the Calendar

The simplest way to get the currently selected date(s) of a Calendar instance is
just to call getSelectedDates() on the instance, which will return an array of
Date objects:

http://developer.yahoo.com/yui/docs/YAHOO.widget.Calendar.html#method_getSelecte\
dDates


Your code would look like:

var dates = myCalendar.getSelectedDates();

Have you tried this method?

John

--- In ydn-javascript@yahoogroups.com, "gjozzimo" <gjozzimo@...> wrote:
>
> In this example the dates selected are written to the page via innerHTML.
http://developer.yahoo.com/yui/examples/calendar/events.html
>
> I am trying to capture the date selected by the user and use it as a variable
in another script. I've tried numerous way of capturing the date selected via
one of the functions provided and ones I've created without success. It looks
straight forward, but I cant' wrap my head around why the functions provided
won't return a variable I can use. They all end up "undefined". Any insight
would be appreciated. Thanks
>





Thu Jul 9, 2009 9:02 pm

theblargoner
Offline Offline
Send Email Send Email

Forward
Message #50387 of 52114 |
Expand Messages Author Sort by Date

In this example the dates selected are written to the page via innerHTML. http://developer.yahoo.com/yui/examples/calendar/events.html I am trying to capture...
gjozzimo
Offline Send Email
Jul 9, 2009
5:27 pm

The simplest way to get the currently selected date(s) of a Calendar instance is just to call getSelectedDates() on the instance, which will return an array of...
theblargoner
Offline Send Email
Jul 9, 2009
9:02 pm

... I did try it. Here is what I used: function showDate() { var pickDate = yuicalendar.getSelectedDates(); return (pickDate); } No joy.... I don't think I...
gjozzimo
Offline Send Email
Jul 10, 2009
5:33 pm

Keep in mind getSelectedDates() returns an array, even for a single-select calendar instance. So you probably want: function showDate() { var dates =...
theblargoner
Offline Send Email
Jul 10, 2009
5:40 pm

No joy.... it must be my implementation.... I either get showDate() as undefined or yuicalendar as undefined... Mercy! Looking closer at the Calendar...
gjozzimo
Offline Send Email
Jul 13, 2009
1:02 pm

Do you have a link to a page with your code? Or can you post the code here? It's very difficult to know why those values are undefined for you without seeing...
theblargoner
Offline Send Email
Jul 13, 2009
8:02 pm

The following script successfully writes the current date to the "evtentries" div tag when the calendar opens and when any new calendar date is selected, so I...
gjozzimo
Offline Send Email
Jul 14, 2009
10:14 am

Well, it's difficult to find the problem in different, working code :) This code is similar to what appears in the YUI example. You've attached an event...
theblargoner
Offline Send Email
Jul 15, 2009
5:13 am

Yep, makes perfect sense, easier said then done... Now to warp my mind from server side to client side scripting and figure out how to implement this. Thanks...
gjozzimo
Offline Send Email
Jul 15, 2009
1:40 pm

Frankly I don't think it is possible.. Your insight and recommendations are on the money and work in most cases, but for the widget itself as well as data to...
gjozzimo
Offline Send Email
Jul 16, 2009
5:25 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help