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

9095Re: Calendar does not disappear when a date is selected

Expand Messages
  • Satyen Desai
    Feb 2, 2007
      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/javascript">

      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;

          var cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");
          cal1.selectEvent.subscribe(selectHandler, cal1);
          YAHOO.util.Event.addListener("showCal", "click", cal1.show, cal1, true);
      YAHOO.util.Event.addListener(window, "load", init);
    • Show all 3 messages in this topic