Search code examples
postyui

POST value of date picked in YUI calendar


I've been looking every where, and the tutorial doesn't seem to work when I use it. I saw something like getfullmonth, getfullyears etc. ... anyway, I'm using this code:

My js:

<script> 
   YAHOO.namespace("example.calendar"); 
   YAHOO.example.calendar.init = function() { 
      YAHOO.example.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1","cal1Container", {PAGES:1}); 
      YAHOO.example.calendar.cal1.render(); 
   } 
   YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);    
</script>

And this is my HTML:

<input type="text" value="I WANT TO PUT THE SELECTED DATE HERE" id="datechoix" class="n-input2" name="datechoix" readonly="readonly"  />
<div id="cal1Container" style="margin-top:15px;"></div>

Anyone got a good tutorial or a complete answer maybe?


Solution

  • You have to listen to the select-date-event. It fires if a user selects a date and holds the date information as arguments.

    See this example: http://yui.github.io/yui2/docs/yui_2.9.0_full/examples/button/btn_example09.html