<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ajax Bestiary &#187; calendar</title>
	<atom:link href="http://www.ajaxbestiary.com/tag/calendar/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxbestiary.com</link>
	<description>AJAX Development, News, Techniques &#38; More</description>
	<lastBuildDate>Sat, 19 Jun 2010 13:43:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>YUI Calendar Popup from Text Input</title>
		<link>http://www.ajaxbestiary.com/2008/10/19/yui-calendar-popup-from-text-input/</link>
		<comments>http://www.ajaxbestiary.com/2008/10/19/yui-calendar-popup-from-text-input/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 01:05:20 +0000</pubDate>
		<dc:creator>Don Albrecht</dc:creator>
				<category><![CDATA[Widget]]></category>
		<category><![CDATA[YUI]]></category>
		<category><![CDATA[calendar]]></category>

		<guid isPermaLink="false">http://www.ajaxbestiary.com/?p=327</guid>
		<description><![CDATA[

I needed a way to provide my users with a date picker that was automatically provided when a text area received focus.  I was eager to use the excellent YUI calendar as a starting point, but the provided documentation didn&#8217;t provide a solid example for this type of implementation.
Dav Glass has provided a solid example [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>I needed a way to provide my users with a date picker that was automatically provided when a text area received focus.  I was eager to use the excellent <a title="Yui Calendar Documentation" href="http://developer.yahoo.com/yui/calendar/">YUI calendar</a> as a starting point, but the provided documentation didn&#8217;t provide a solid example for this type of implementation.</p>
<p>Dav Glass has provided a solid example of the<a href="http://blog.davglass.com/files/yui/cal2/"> Calendar tied to a text input</a>. But, his example is highly dependent on the text input having specific ids.  This doesn&#8217;t take advantage of YUI&#8217;s excellent Selector library really didn&#8217;t meet my need for a simple universal solution.</p>
<h2><span style="font-weight: normal;">K</span>ey Requirements:</h2>
<ol>
<li>Progressive Enhancement (No inline javascript)</li>
<li>Yui based</li>
<li>Universal implementation across all pages in a site.</li>
<li>Support for multiple date inputs on a page.</li>
</ol>
<h2>Getting Started:</h2>
<div>The bulk of the code used is pretty solidly Dav&#8217;s I&#8217;ve simply replaced all of the hard coded references to dynamically generated targets and moved from hard coded ID&#8217;s for the target fields to a css class.  Lastly, I&#8217;ve added a &#8220;activeCal&#8221; class to the currently active target input so that one calendar can be recycled across multiple text areas on the page.</div>
<h2>Source:</h2>
<p><code></p>
<div>var cal1;</div>
<div>var over_cal = false;</div>
<div>function transmogCals() {</div>
<div>    cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");</div>
<div>    cal1.selectEvent.subscribe(getDate, cal1, true);</div>
<div>    cal1.renderEvent.subscribe(setupListeners, cal1, true);</div>
<div>    var pickers =  YAHOO.util.Selector.query('.date-picker'); </div>
<div>for( i in pickers){</div>
<div>    YAHOO.util.Event.addListener(pickers[i], 'focus', showCal);</div>
<div>    YAHOO.util.Event.addListener(pickers[i], 'blur', hideCal);</div>
<div>    }</div>
<div>cal1.render();</div>
<div>}</div>
<div>function setupListeners() {</div>
<div>    YAHOO.util.Event.addListener('cal1Container', 'mouseover', overCal);</div>
<div>    YAHOO.util.Event.addListener('cal1Container', 'mouseout', outCal);</div>
<div>}</div>
<div>function getDate() {</div>
<div>        var calDate = this.getSelectedDates()[0];</div>
<div>        calDate = (calDate.getMonth() + 1) + '/' + calDate.getDate() + '/' + calDate.getFullYear();</div>
<div>        YAHOO.util.Selector.query('.activeCal')[0].value = calDate;</div>
<div>        over_cal = false;</div>
<div>        hideCal();</div>
<div>}</div>
<div>function showCal(e, targ) {</div>
<div>    var xy = YAHOO.util.Dom.getXY(this);</div>
<div>    var el = new YAHOO.util.Element(this); </div>
<div>    el.addClass('activeCal');</div>
<div>    var date = this.value;</div>
<div>    if (date) {</div>
<div>        cal1.cfg.setProperty('selected', date);</div>
<div>        cal1.cfg.setProperty('pagedate', new Date(date), true);</div>
<div>        cal1.render();</div>
<div>    }</div>
<div>    YAHOO.util.Dom.setStyle('cal1Container', 'display', 'block');</div>
<div>    xy[1] = xy[1] + 20;</div>
<div>    YAHOO.util.Dom.setXY('cal1Container', xy);</div>
<div>}</div>
<div>function hideCal() {</div>
<div>    if (!over_cal) {</div>
<div>         var el = new YAHOO.util.Element(this); </div>
<div>        el.removeClass('activeCal');</div>
<div>        YAHOO.util.Dom.setStyle('cal1Container', 'display', 'none');</div>
<div>    }</div>
<div>}</div>
<div>function overCal() {</div>
<div>    over_cal = true;</div>
<div>}</div>
<div>function outCal() {</div>
<div>    over_cal = false;</div>
<div>}</div>
<div>YAHOO.util.Event.addListener(window, 'load', transmogCals);</div>
<p></code></p>
<p> </p>
<h2>Adding it to your page</h2>
<p>Integrating the code into the page is VERY easy.</p>
<p>In the header of the page add the following css includes.</p>
<pre>&lt;link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.6.0/build/calendar/assets/skins/sam/calendar.css"&gt;</pre>
<div><span>In the footer add the following script include and include the date-picker.js file</span></div>
<div>
<table class="dp-xml" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="line2"><span class="tag">&lt;</span><span>script </span><span class="attribute">type</span><span>=</span><span class="attribute-value">&#8220;text/javascript&#8221;</span><span> </span><span class="attribute">src</span><span>=</span><span class="attribute-value">&#8220;http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js&amp;2.6.0/build/calendar/calendar-min.js&amp;2.6.0/build/selector/selector-beta-min.js&#8221;</span><span>&gt;</span><span class="tag">&lt;/</span><span>script</span><span class="tag">&gt;</span><span> </span></td>
</tr>
</tbody>
<thead></thead>
</table>
</div>
<div>Lastly, place a class of date-picker to any text fields you want to tie to the input and add the following to your pages markup:</div>
<p> </p>
<p><code></p>
<div>&lt;div class='yui-skin-sam' style="position:absolute; left:-1000px;"&gt;</div>
<div>     &lt;div id="cal1Container"&gt;&lt;/div&gt;</div>
<div>   &lt;/div&gt;</div>
<p></code></p>
<p><img src="http://www.ajaxbestiary.com/?voyeur=1"></p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://www.ajaxbestiary.com/2008/10/19/yui-calendar-popup-from-text-input/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>A Mootools Based Calendar Widget from NoGray</title>
		<link>http://www.ajaxbestiary.com/2007/10/06/a-mootools-based-calendar-widget-from-nogray/</link>
		<comments>http://www.ajaxbestiary.com/2007/10/06/a-mootools-based-calendar-widget-from-nogray/#comments</comments>
		<pubDate>Sat, 06 Oct 2007 11:59:05 +0000</pubDate>
		<dc:creator>Don Albrecht</dc:creator>
				<category><![CDATA[calendar]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[Widgets]]></category>

		<guid isPermaLink="false">http://www.ajaxbestiary.com/2007/10/06/a-mootools-based-calendar-widget-from-nogray/</guid>
		<description><![CDATA[

No Gray Calendar is a simple, easy to use and highly configurable calendar widget built on the mootools framework. The calendar is built dynamically from an &#60;a&#62; element it&#xA0; modifies specified input fields and is attached to a specified container element.&#xA0; 
Features:

Create any numbers of months per calendar. 
Set the weekend, days off, holidays (dates [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="455" alt="nogrey" src="http://www.ajaxbestiary.com/wp-content/uploads/2007/10/nogrey-thumb.jpg" width="484" border="0" />No Gray Calendar is a simple, easy to use and highly configurable calendar widget built on the mootools framework. The calendar is built dynamically from an &lt;a&gt; element it&#xA0; modifies specified input fields and is attached to a specified container element.&#xA0; </p>
<p><strong>Features:</strong></p>
<ul>
<li>Create any numbers of months per calendar. </li>
<li>Set the weekend, days off, holidays (dates off), start day of the week. </li>
<li>Start and end date. </li>
<li>Multi selection with limits or without. </li>
<li>Skinnable (using CSS). </li>
<li>Can have any number of calendars in any page. </li>
<li>Optimized for best performance. </li>
</ul>
<p>You can find it online at: <a title="http://nogray.com/calendar.php" href="http://nogray.com/calendar.php">http://nogray.com/calendar.php</a></p>
<p>Usage Examples After the Jump:</p>
<p><span id="more-112"></span></p>
<p>For example:</p>
<p>HTML:</p>
<pre>&lt;input type=&quot;text&quot; id=&quot;date3&quot; name=&quot;date3&quot;&gt; &lt;a href=&quot;#&quot; id=&quot;cal3_toggler&quot;&gt;Open Calendar&lt;/a&gt; &lt;div id=&quot;calendar3&quot;&gt;&lt;/div&gt;</pre>
<p>Script:</p>
<p></p>
<pre>Script: var calender3 = new Calendar(&quot;calendar3&quot;, &quot;cal3_toggler&quot;, {inputField:'date3', numMonths:3, multiSelection:true, maxSelection:5, forceSelections:[ {date:'last Saturday'} ], dateFormat:'D, d M Y :: ', idPrefix:'cal3'});</pre>
<p>&#xA0;</p>
<p>In the above example: the calendar is placed in the calendar3 div when the cal3_toggler is clicked and modfies the date3 field. </p>
<p>Found online via: <a href="http://www.webappers.com/2007/10/05/nogray-free-highly-customizable-javascript-calendar/">webappers</a></p>
<p><img src="http://www.ajaxbestiary.com/?voyeur=1"></p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://www.ajaxbestiary.com/2007/10/06/a-mootools-based-calendar-widget-from-nogray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
