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

9176RE: [ydn-javascript] Re: Calendar does not disappear when a date is selected

Expand Messages
  • Rebecca Oehmen
    Feb 5, 2007
    • 0 Attachment

      Hi Satyen,

      Thanks so much for your help. Adding ‘cal.hide( )’ to my selectHandler function fixed the problem and now it works great!

      ~Rebecca

       


      From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyen Desai
      Sent: Friday, February 02, 2007 7:44 PM
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] Re: Calendar does not disappear when a date is selected

       

      Hey Rebecca,

      I don't see your "mySelectHandler" in the code snippet you posted, but this is probably the place to hide your calendar. That way you don't need to attach a DOM event handler to (what seems to be) the Calendar Container DIV

      Here's an example which hides the calendar on selection after picking up the selected date, which seems to work consistently. ..

      <!-- Doesn't account for positioning the calendar in relation to the text box, just needed somewhere to dump the selected value -->
      <input type="text" id="date" name="date" /><button id="showCal">Pick Date</button>
      <div id="cal1Container"></div>

      <script type="text/javascri pt">


      function init() {
                     
          function selectHandler( type, args, cal) {
         
              var selDateArray = args[0][0];

              var yr = selDateArray[ 0];
              var month = selDateArray[ 1];
              var dt = selDateArray[ 2];
                         
              YAHOO.util.Dom. get("date" ).value = month + "/" + dt + "/" + yr;

              cal.hide();

          }
                     
          var cal1 = new YAHOO.widget. Calendar( "cal1","cal1Cont ainer");
          cal1.selectEvent. subscribe( selectHandler, cal1);
                     
          cal1.hide();
          cal1.render( );
                     
          YAHOO.util.Event. addListener( "showCal" , "click", cal1.show, cal1, true);
      }
                     
      YAHOO.util.Event. addListener( window, "load", init);
      </script>

    • Show all 3 messages in this topic