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

Calendar selected Format

Expand Messages
  • thespursfan29
    Hello. I have got the calendar working and onSelect, the value of the selected date is put into a read only text box (eventually it will be hidden, but read
    Message 1 of 2 , Sep 28, 2006
    • 0 Attachment
      Hello. I have got the calendar working and onSelect, the value of the
      selected date is put into a read only text box (eventually it will be
      hidden, but read only for now so I can see it). However, the value of
      the selected date is on the format "2006,9,28" ie: yyyy,m,d.

      The code I used is this:
      -------------------------------------------------------
      <script language="javascript">

      function init() {
      apearedDateCalendar = new
      YAHOO.widget.Calendar("apearedDateCalendar","calendarContainer","<?=date("n/Y")?>","<?=date("n/j/Y")?>");

      apearedDateCalendar.onSelect = function(selected) {
      /* alert("selected: " + selected); */

      document.addClipForm.appearedDate.value = selected;
      }

      apearedDateCalendar.render();
      }
      YAHOO.util.Event.addListener(window, "load", init);

      </script>

      <div id="calendarContainer"></div>
      <div style="clear: both;"></div>
      <input type="text" name="appearedDate" id="appearedDate" readonly />
      -----------------------------------------------------------------------

      I would like to know how to modify the value of "selected" in my
      appearedDateCalendar.onSelect function, so it will be yyyy-mm-dd.
      Is that an easy fix?
      I want this date to go directly into a mysql database, and that is the
      format mysql uses.

      Thanks for any help! I appreciate it.
    • thespursfan29
      Ok, scratch that. I think I can do it via javascript. I found a great example of exactly what I needed: http://blog.davglass.com/files/yui/cal2 I think that
      Message 2 of 2 , Sep 28, 2006
      • 0 Attachment
        Ok, scratch that. I think I can do it via javascript.

        I found a great example of exactly what I needed:
        http://blog.davglass.com/files/yui/cal2

        I think that link may be posted on here already. But, one of the code
        examples, (Calendar Attached to Text Input) is what I needed.
      Your message has been successfully submitted and would be delivered to recipients shortly.