Loading ...
Sorry, an error occurred while loading the content.

5306Re: Calendar - Select range of dates

Expand Messages
  • jfasaldarriaga
    Sep 29, 2006
      --- In ydn-javascript@yahoogroups.com, "jfasaldarriaga"
      <jfasaldarriaga@...> wrote:
      >
      > Hi :) Im trying to do this, when I write in a text input whit an
      > onChange event this value will be renderer on the calendar, thats
      > because I need insert ranges of dates in the calendar but all this
      > range needs to be in normal dates, 01/01/2006-01/20/2006 ->
      > 01/01/2006, 01/02/2006 ...
      >
      > This is my code:
      >
      > <html>
      > <head>
      > <script type="text/javascript" src="build/yahoo/yahoo.js"></script>
      > <script type="text/javascript" src="build/event/event.js"></script>
      > <script type="text/javascript" src="build/dom/dom.js"></script>
      > <script type="text/javascript"
      src="build/calendar/calendar.js"></script>
      > <link type="text/css" rel="stylesheet"
      > href="build/calendar/assets/calendar.css">
      > <script language="javascript">
      > var cal1;
      > function init() {
      > cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");
      > cal1.Options.MULTI_SELECT = true;
      > /*var customConfig = function() {
      > this.Options.MULTI_SELECT = true;
      > }
      >
      > cal1.setChildFunction("customConfig", customConfig);
      > cal1.callChildFunction("customConfig");*/
      >
      > cal1.render();
      > }
      > </script>
      > </head>
      > <body onload="init()">
      > <input type="text" name="program_dates" id="program_dates"
      > onChange="selectDates( this.value );"/>
      > <script type="text/javascript">
      > function selectDates( value )
      > {
      > alert( "Value: " + value );
      > cal1.addRenderer( value, init );
      > }
      > </script>
      > <div id="cal1Container"></div>
      > </body>
      > </html>
      >
      > Any help will be apreciated. Thx.
      >

      Well, I guess my problem is resolved, I made this:

      <input type="text" name="program_dates" id="program_dates"
      onChange="selectDates( this.value );"/>
      <script type="text/javascript">
      function selectDates( value )
      {
      alert( "Value: " + value );
      cal1.select( value );
      cal1.render();
      alert( "Dates: " + cal1.getSelectedDates() );
      }
      </script>

      So, now all the dates on the input were selected by the calendar, now
      I need to return this selected dates with this format: MM/DD/YYYY,
      somebody know how to do this ?

      Thx.
    • Show all 4 messages in this topic