<?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>WebTigers</title>
	<atom:link href="http://webtigers.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://webtigers.net</link>
	<description>Professional UI</description>
	<lastBuildDate>Sun, 03 Apr 2011 10:57:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Zend Framework &#8211; Modules &amp; Layouts</title>
		<link>http://webtigers.net/articles/modules-layouts/</link>
		<comments>http://webtigers.net/articles/modules-layouts/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 10:18:29 +0000</pubDate>
		<dc:creator>K. Beau Beauchamp</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://webtigers.net/?p=462</guid>
		<description><![CDATA[As a UI developer it is important to always be expanding your skillsets. I recently began learning the ins and outs of Zend Framework. Okay, I&#8217;m not the first to say this and I wont be the last, but Zend Framework&#8217;s documentation is not just terrible, but abysmally terrible, especially for newbies. The docs are [...]]]></description>
			<content:encoded><![CDATA[<p>As a UI developer it is important to always be expanding your skillsets. I recently began learning the ins and outs of Zend Framework.</p>
<p>Okay, I&#8217;m not the first to say this and I wont be the last, but Zend Framework&#8217;s documentation is not just terrible, but abysmally terrible, especially for newbies. The docs are disorganized, often times inaccurate for the current build version, and exhibit a serious lack of useful snippet examples. Zend could really learn a few lessons from the folks at <a href="http://codeigniter.com" target="_blank">CodeIgniter</a> on how to write decent documentation. PHPDocs are not cutting it guys. Okay, enough of my ranting.</p>
<h2 class="subhead">ZendTiger</h2>
<p>I wanted to put together a pre-configured setup of Zend Framework   that would give me some basic enterprise level administration of users,   organizations, permissions and other baseline security features for  some  of my various projects. I&#8217;m calling it <strong>ZendTiger</strong>.</p>
<p><strong>ZendTiger</strong> is a working configuration of Zend Framework 1.11.4 that uses fully autonomous <em><strong> modules </strong></em>and module-specific <strong><em>layouts </em></strong>while keeping the framework&#8217;s own internal default  routing. The goal was to have self-configuring modules that just drop-in  without having to configure any <strong><em>.ini</em></strong> files except what might be within the module itself. I also want to be able to add custom <strong><em>themes </em></strong>or &#8220;skins&#8221; to the application based on some variable within the layout which can be set automatically within the application itself. The final application also needs to be localized.</p>
<h3 class="subhead">Getting Started</h3>
<p>One of the first things you learn as a ZF newbie is that Zend does not work out of the box with modules and layouts. It just doesn&#8217;t self configure very well. Even with Zend Tool. You will spend not hours, but DAYS, trying to figure out how to get ZF to render pages using its default MVC while also using modules and layouts.</p>
<p>Fortunately, I have done some of the legwork here for you. After days of searching and learning and running into dead ends, I have finally pieced together a clean, working setup of ZF with modules and layouts humming along very nicely without all of the cruft of numerous plugins.</p>
<h3 class="subhead">Modules</h3>
<p>ZF deals with modules fairly well at this point but modules still have a way to go before they are seamlessly integrated within the framework. Some other ZF engineers have described modules as &#8220;second class citizens&#8221; of the framework and I am inclined to agree with this notion.</p>
<p>For instance, the Zend Tool CLI does NOT automatically setup modules properly for you. I had to fiddle with the <em>application.ini</em> and module bootstraps for some time before finally getting modules setup and working properly.</p>
<p>The goal of modules is (or should be) to allow for the dropping in of complete and isolated groups of functionality without affecting any other part of the application. This does not mean that modules cannot be dependent (use the functionality of) other modules, it just means that they need to be &#8220;drop-in-able&#8221; and you should not need to touch anything in the application configuration to make them work. Plug-and-play is the goal.</p>
<p>Also note that module bootstrapping can create a problem for some who are not aware of how modules work in ZF. ALL bootstrapping files are processed from all modules during the bootstrapping process, not just the active module&#8217;s. This is done on purpose because of possible module interdependencies, or one module needing the functionality of another module. If you build your bootstrapping without some kind of logic within your bootstrap files, you can easily have your modules overwriting the bootstrapping of other parts of your application. Keep this in mind when setting up your bootstrap files.</p>
<h3 class="subhead">Layouts</h3>
<p>Modules open the door to the desire to have different themes or skins for different modules of the application. Module-specific layouts is how this is achieved. However, once again, ZF doesn&#8217;t provide this configuration for your out of the box. Enabling Layouts using Zend Tool and then creating a module will not automatically add a <em>/layouts</em> folder to your newly created module. You have to do this by hand.</p>
<p>Once you initialize Zend Layout, there really isn&#8217;t an inherent way nor obvious way to configure ZF to use module-specific layouts. Many of the examples I looked at online of how to configure ZF to use layouts were either very complex for older versions of ZF, or the solutions just didn&#8217;t seem like the people writing them knew what they were doing in working WITH the framework. My coding philosophy is never work <em>against </em>the framework, work <em>with </em>the framework&#8217;s inherent ability whenever possible.</p>
<p>The simpler the code the better.</p>
<p>Most people want layouts to be set automatically based on the module being called. If a module has its own layout, we need to use that; if a module has no layout, use the default. This kind of logic for setting the layout automatically is best placed in a plugin at a point when the module name is known and the Zend Layout class has been instantiated. <strong>ZendTiger&#8217;s</strong> Layout plugin does this just after the <em>routerShutdown</em> event. This very early setting leaves open option of re-setting /overriding the layout within the controller if necessary, like with error message pages.</p>
<p>&#8230;</p>
<h2 class="subhead">Conclusion</h2>
<p>I&#8217;ve not posted a bunch of code snippets here at this point, just download the <strong>ZendTiger </strong>files and you&#8217;ll be up and running. <strong>ZendTiger </strong>expects your ZF library files to already be in your PHP path. If <strong>ZendTiger </strong>cannot find your ZF files, setup your environment so that PHP knows where your ZF library files live.</p>
<p>I&#8217;ll add more as I continue developing &#8230; I hope <strong>ZendTiger </strong>saves you a lot of time. Cheers!</p>
<h2 class="subhead">Downloads</h2>
<p>The following file is the latest working version of <strong>ZendTiger</strong>.</p>
<p><strong><a href="http://webtigers.net/files/ZendTiger.zip">Download ZendTiger</a></strong></p>
<h2 class="subhead">Credits</h2>
<p>I could not have gotten very far on this project without the help of the following people and their blogs:</p>
<p><strong>Jeroen Keppens</strong> of <a href="http://www.amazium.com/blog/create-modular-application-with-zend" target="_blank"><strong>Amazium</strong></a><br />
<strong>Leonard Dronkers</strong> of <a href="http://www.sreknord.net/blog/zend-framework/zend-framework-module-config-the-easy-way" target="_blank"><strong>Sreknord</strong></a></p>
<p>If WebTigers has helped you out, feel free to link to us!</p>
<p>____________________________</p>
<p><em>K. Beau Beauchamp is a professional UI developer with over 15 year&#8217;s experience in graphic design, marketing communications and object-oriented UI programming. Beau can be contacted via email <a href="http://webtigers.net/contact/">here</a>.</em></p>
<h2 class="subhead" style="text-align: center;"><span style="color: #999999;">Ж</span></h2>
]]></content:encoded>
			<wfw:commentRss>http://webtigers.net/articles/modules-layouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding A Good UI Developer</title>
		<link>http://webtigers.net/articles/finding-a-good-ui-developer/</link>
		<comments>http://webtigers.net/articles/finding-a-good-ui-developer/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 18:25:34 +0000</pubDate>
		<dc:creator>K. Beau Beauchamp</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://webtigers.net/?p=137</guid>
		<description><![CDATA[The UI, User Interface, of an application is all to often the most overlooked aspect of a project; which is odd because it is the most visible aspect of a project and it&#8217;s one of those critical &#8220;first impression&#8221; aspects that can make or break a product&#8217;s sale. The UI, if it&#8217;s well engineered, can [...]]]></description>
			<content:encoded><![CDATA[<p>The UI, <em>User Interface</em>, of an application is all to often the most overlooked aspect of a project; which is odd because it is the most visible aspect of a project and it&#8217;s one of those critical &#8220;first impression&#8221; aspects that can make or break a product&#8217;s sale.</p>
<p>The UI, if it&#8217;s well engineered, can shine a light on how professional the rest of your team&#8217;s efforts have been. Likewise, a badly designed UI can cast a shadow over what might otherwise be a really great application.</p>
<p>But before we learn how to find a good UI professional, it makes sense to understand what UI is and how it fits into a truly professional product.</p>
<h2 class="subhead">Understanding Professional UI</h2>
<p>You can assemble a world class Java / Oracle team who just built the most amazing technology, but if your UI has been an after thought, bad UI can make all that high-end technology look like it was written by a bunch of amateurs.</p>
<h3 class="subhead">Not Just Another Pretty Face</h3>
<p>The days of being able to use your Java or .NET people to build UI are over, actually they were over years ago, but sometimes it takes time for the rest of the development world to catch up to the technical realities.</p>
<div class="inset_left">&#8220;UI is more than just nice looking graphics.&#8221;</div>
<p>Today&#8217;s UI developers are highly skilled, multi-disciplined specialists trained and experienced to not just add nice graphics and code HTML, but functionally design and improve how the application &#8220;interacts&#8221; with the end-user.</p>
<p>Professional UI is more than just nice looking graphics.</p>
<p>I recently worked with an IT manager of a major US corporation who told me, <em>&#8220;We need to put some serious lipstick on this.&#8221;</em> The problem wasn&#8217;t really their graphics, it was their workflow that needed a serious update and reworking. No amount of &#8220;lipstick&#8221; I could come up with was going to fix a blatantly bad design. They had let their Java staff design how the application would behave and it caused some serious confusion for the end users.</p>
<h2 class="subhead">Awesome UI Is Not The Easy Path</h2>
<p>The problem is that your users don&#8217;t think like programmers, and programmers usually don&#8217;t spend a lot of time thinking about, <em>&#8220;Now, how can I make this easier for others to use?&#8221;</em> No, generally their thought is, <em>&#8220;How can I make this easier for me to code.&#8221;</em></p>
<p>It&#8217;s this kind of situation that results in a poorly designed amateur UI.</p>
<p>Well designed UI is not always easy to code. It requires that you take the time to really think through the user experience and workflow, always asking the question: <em>&#8220;Now, how would our users really like to see this work?&#8221;</em> Sometimes a quick DHTML pop-up or slide-down form is what would make the user experience much more smooth; but it takes a bit more time to build these little Web 2.0 gems than it would be to &#8220;force&#8221; your user to a whole new page or code and ugly pop-up browser window.</p>
<h3 class="subhead">First Things First</h3>
<p>The basic problem with using back-end developers to build the front-end part of the application is that typically the back-end people can really only think like back-end developers, not end-users. The Java guy starts the application development process by building a database. <em>That</em> is exactly the wrong way to approach an application.</p>
<p>An application that will exhibit professional UI should always begin with the public interface development first. Whether you prefer to use wireframe documents or just rough-code some HTML pages out of the gate, these initial interfaces will be crucial in determining what functionality fires and when; and what, exactly, needs to ultimately get persisted in the database and in what tables.</p>
<p>Ultimately, building projects this way allows for much better documentation,  it saves a lot of time and streamlines the effort for the back-end guys.</p>
]]></content:encoded>
			<wfw:commentRss>http://webtigers.net/articles/finding-a-good-ui-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enterprise-class JavaScript</title>
		<link>http://webtigers.net/javascript/enterprise-javascript/</link>
		<comments>http://webtigers.net/javascript/enterprise-javascript/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 18:27:24 +0000</pubDate>
		<dc:creator>K. Beau Beauchamp</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://webtigers.net/?p=139</guid>
		<description><![CDATA[What JavaScript framework or library should your team really be using? In this article, Beau Beauchamp discusses the differences between two Titans of the JavaScript world.]]></description>
			<content:encoded><![CDATA[<p>What JavaScript framework or library should your team really be using? In this article, Beau Beauchamp discusses the differences between two Titans of the JavaScript world.</p>
<h2 class="subhead">Enterprise-class JavaScript</h2>
<p>Here&#8217;s the scene: You&#8217;re the new project manager sitting at the conference table with the rest of the development team. You&#8217;ve just hired a new UI person to take the reins of your application&#8217;s front-end and deliver a product that will be a slick Web 2.0 production.</p>
<p>Mind you, the reason you hired a UI person in the first place is because your development team has been struggling with UI issues. The CSS is a mess, there are cross-browser display issues, and sometimes the DHTML works and sometimes it quits without warning. Your dev team has spent countless hours fumbling with these issues without a whole lot of success or the successes have come at a steep price in over-spent hours.</p>
<p>The discussion inevitably turns to the JavaScript and what is currently in-place within the application. Some of it is custom, some of it is jQuery, there&#8217;s an open-source piece here and purchased module for image display over there.</p>
<p>Okay, it&#8217;s a mess. You know it&#8217;s not working so you ask your UI pro for their input. The UI pro recommends a wholesale change in the JS library and a move to a full-stack framework. The rest of the dev team groans and begins to grumble. &#8220;Replace all this work!? Can&#8217;t you just fix what&#8217;s broken? That&#8217;s why we hired you!&#8221;</p>
<p>Your new UI pro simply replies, &#8220;I just fixed the problems. This is an enterprise-class application and it needs a robust framework to make the UI perform uniformly. You cannot piece these things together with scotch-tape and bubble gum. It&#8217;s all got to work together. Otherwise you end up with a mess of conflicting standards and multiple incompatible objects all trying to talk to each other through yet even more translation objects.&#8221;</p>
<p>&#8220;But we&#8217;re using a framework, jQuery!&#8221; the team lead insists.</p>
<p>Then your new UI pro drops a bombshell and says, &#8220;jQuery is not an enterprise-class framework.&#8221;</p>
<p>The room erupts into brash dissent from the developers who wrote the current UI. &#8220;Like hell it&#8217;s not! jQuery is the more widely used framework on the planet!&#8221;</p>
<p>Your UI pro allows the din to quiet. They&#8217;ve been down this road of discussion more often than they care to count, &#8220;jQuery is not the most widely used &#8216;framework&#8217; on the planet, because it&#8217;s not a &#8216;framework&#8217;, it&#8217;s a library. Big difference.&#8221;</p>
<h2 class="subhead">Clash of the Titans</h2>
<p>The above scenario is one I have had to deal with on a number of occasions.</p>
<p>As a project manager you have a lot of things to manage with your project, one of the most important is what technologies will be implemented to build the application. If you have a Java or .NET shop, those decisions are easy for the backend, you use what your engineering staff know how to use.</p>
<p>But what do you do if your engineering staff doesn&#8217;t know what to use and really doesn&#8217;t know UI all that well? Guess? Use what&#8217;s popular?</p>
<p>More often than not when I come into a shop where a project is already underway, the backend team has chosen a JavaScript library for the front-end. Generally it&#8217;s jQuery. The question I ask is, &#8220;Why did you go with jQuery?&#8221; and the answer is always the same, &#8220;Everybody uses jQuery. It&#8217;s industry standard. It&#8217;s what we know.&#8221;</p>
<p>The last part is the true reason. &#8220;It&#8217;s what we know.&#8221; The unspoken reason is also, &#8220;jQuery is super easy and helps us speed through a lot of basic DHTML we don&#8217;t have a clue about how to write otherwise.&#8221;</p>
<p>One of my primary beefs with jQuery is that it hides the nuts and bolts of true JavaScript coding and forces you to code it&#8217;s way instead of in a natural object-oriented fashion the way JavaScript was designed to work. While jQuery&#8217;s syntax is fast and easy, it&#8217;s not really JavaScript, it&#8217;s a language called jQuery that&#8217;s built on top of JavaScript.</p>
<p>Why is that a big deal? Well for starters, I&#8217;ve worked with engineers who said they knew JavaScript but the reality was if you removed the jQuery library from the application, they were hopelessly lost.</p>
<p>jQuery was really the only &#8220;JavaScript&#8221; they knew how to write. Ouch.</p>
]]></content:encoded>
			<wfw:commentRss>http://webtigers.net/javascript/enterprise-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YUI: getElementsBy</title>
		<link>http://webtigers.net/articles/yui-getelementsby/</link>
		<comments>http://webtigers.net/articles/yui-getelementsby/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 01:10:50 +0000</pubDate>
		<dc:creator>K. Beau Beauchamp</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://webtigers.net/?p=13</guid>
		<description><![CDATA[YUI is one of the most powerful Javascript frameworks in existence today. Yet, far too many UI programmers are unaware of this true full-stack JavaScript framework and its amazing capabilities. Beau Beaucahmp discusses one of the more powerful DOM functions of the YUI library: the very cool getElementsBy DOM function. Super-Awesome Power At Your Fingertips [...]]]></description>
			<content:encoded><![CDATA[<p>YUI is one of the most powerful Javascript frameworks in existence today. Yet, far too many UI programmers are unaware of this true <a href="http://webtigers.net/javascript/enterprise-javascript/">full-stack JavaScript framework</a> and its amazing capabilities. Beau Beaucahmp discusses one of the more powerful DOM functions of the YUI library: the very cool <code>getElementsBy</code> DOM function.</p>
<h2 class="subhead">Super-Awesome Power At Your Fingertips</h2>
<p>If you&#8217;ve been programming in UI for any length of time then you&#8217;re familiar with Javascript&#8217;s built-in <code>getElementById</code> function that is used to return a single element within the DOM tree by simply passing in the element&#8217;s ID. YUI&#8217;s <code>getElementsBy</code> is quite simply <code>getElementById</code> on some serious steroids. Not only does this powerful function allow you to snap-up a single element, but it can grab a whole array of elements chosen and filtered any way you like, all in a single call.</p>
<p>But wait, there&#8217;s more! <code>getElementsBy</code> also allows you to manipulate each of the elements within your array with an optional function you supply!</p>
<h3 class="subhead">Setting-up Your Page to Use YUI</h3>
<p>First you&#8217;ll need to download and copy the core YUI files to a directory on your site. I usually like to have a <code>/javascrpt</code> or <code>/js</code> folder inside my document root that holds all of my JavaScript files. The core YUI files you&#8217;ll need will be found inside the <code>/yui/build</code> directory. I like to copy YUI&#8217;s <code>/build</code> folder to my <code>/javascript</code> folder and rename<code> /build</code> to<code> /yui</code> for convenience.</p>
<p>Now add for following code inside the <code>&lt;head&gt; ... &lt;/head&gt;</code> tags of your page:</p>
<pre class="brush:html"><script src="/yui/yahoo-dom-event/yahoo-dom-event.js"></script></pre>
<p>or you can have your page load the YUI files directly from YAHOO! using this script tag instead of the one above:</p>
<pre class="brush:js"><script src="http://yui.yahooapis.com/2.8.1/build/yahoo-dom-event/yahoo-dom-event.js"></script></pre>
<p>Now you&#8217;ll have all of the various YUI Core, DOM and Events functions at your command. Let&#8217;s look at what the <code>getElementsBy</code> function params look like:</p>
<pre class="brush:js">var Dom = YAHOO.util.Dom;
var els = Dom.getElementsBy(
    function(el){ ... },
        tagname,
        parentroot,
        function(el){ ... }
);
</pre>
<p>All of the YUI functions live in the YAHOO namespace. As such, I like to pair down my code by assigning all of the Dom and Event functions to a simple reference var, like Dom. This way, I can access the YUI DOM functions with a simple <code>Dom.getElementsBy()</code> as we see in line 2.</p>
<p>Note that <code>getElementsBy</code> can work with or without returning anything. If you do return elements, note that unlike <code>getElementById</code>, <code>getElementsBy</code> always returns an <code>array()</code> of elements. Even if you will only be returning a single element, keep in mind that it will be referenced as <code>els[0]</code>.</p>
<p>Line 3 is where the real fun begins. You begin gathering your elements with a simple boolean function that returns true or false. Let&#8217;s say I want to toggle a check or uncheck for every checkbox within a form. A good boolean function to use here would be <code>return (el.type == 'checkbox');</code>. Notice that <code>el</code> is an element that will get passed into this function to be tested. If the element has the attribute of <code>type="checkbox"</code> the function will return true and add the element to our <code>els</code> array.</p>
<p>Notice that only the first attribute of <code>getElementsBy</code> is necessary. The second and third parameters can be set to <code>null</code>. However, setting these parameters to <code>null</code> will cause <code>getElementsBy</code> to process EVERY ELEMENT on the page! This is not very efficient, especially for really large pages. That&#8217;s where the second and third parameters of this function come in handy. In line 4 of our code we can specify a specific tag name, such as <code>input</code>. In this way, the <code>getElementsBy</code> function will ignore all elements except input elements which it will then pass to the boolean function we built in the previous paragraph.</p>
<p>Even with this optimization, you still might want to further define where to begin your elements search. <code>getElmentsBy</code> allows you to optionally specify a third parameter, a root parent element to search within. If all of the elements you need to process are the children of a specific div for instance, passing in the ID string or element reference of the containing parent will limit even further where within the DOM <code>getElementsBy</code> needs to look.</p>
<p>So, with these three parameters supplied to our <code>getElmentsBy</code> function, we can collect a very specific set of elements, in our sample case we&#8217;re looking for all of the checkboxes, anywhere within the DOM of our page.</p>
<h2 class="subhead">Putting getElementsBy to Work</h2>
<p>Here&#8217;s where <code>getElmentsBy</code> becomes a real time saver. Normally, once you have built your array, you&#8217;d need to write code that loops through each of the elements within your array to do something with each element of the array; in our case we&#8217;re setting the checkbox elements to either be checked or unchecked. So why not just apply whatever function to each element as it is being added to the array built by <code>getElmentsBy</code>? Brilliant!</p>
<p>The final param of the <code>getElmentsBy</code> function is designed to do just that. Using this optional function, we can apply code to each of the elements being added to our final array. And we&#8217;re not just limited to checking or un-checking chekcboxes here. <em>Anything</em> you can do inside a function can be applied to any, all or some of the array elements. </p>
<p>Use this final function to selectively add an event listener, set element values and/or attributes (which is what we&#8217;re going to do with our checkboxes), or whatever.</p>
<pre class="brush:js">var Dom = YAHOO.util.Dom;
var els = Dom.getElementsBy(
    function(el){
        return ( el.type === 'checkbox' );
    },
    'input',
    'myform',
    function(el){
        el.checked === true;
    }
);
</pre>
<h2 class="subhead">One Call Does It All</h2>
<p>So let&#8217;s show a simple function using <code>getElmentsBy</code> that checks or un-checks all of the checkboxes on a form.</p>
<p>Here&#8217;s the example:</p>
<div class="example">
<p><script type="text/javascript">// <![CDATA[
      	var Dom = YAHOO.util.Dom; 	function toggleCheckboxes(ref){ 		Dom.getElementsBy( 			function(el){ return(el.type == 'checkbox'); }, 			'input', 			'myform', 			function(el){ el.checked = ref.checked; } 		); 	}
// ]]&gt;</script></p>
<form id="myform">
<input onclick="toggleCheckboxes(this);" name="ref" type="checkbox" /><label for="ref">Click me</label></p>
<input name="check1" type="checkbox" value="1" /><label for="check1">One</label></p>
<input name="check2" type="checkbox" value="2" /><label for="check2">Two</label></p>
<input name="check3" type="checkbox" value="3" /><label for="check3">Three</label></p>
<input name="check4" type="checkbox" value="4" /><label for="check4">Four</label></p>
<input name="check5" type="checkbox" value="5" /><label for="check5">Five</label></p>
</form>
</div>
<p>and here&#8217;s the code:</p>
<pre class="brush:html">
<script src="http://yui.yahooapis.com/2.8.1/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript">
    var Dom = YAHOO.util.Dom;
    function toggleCheckboxes(ref){
        Dom.getElementsBy(
            function(el){ return(el.type == 'checkbox'); },
            'input',
            'myform',
            function(el){ el.checked = ref.checked; }
        );
    }
</script>
<form id="myform">
<input onclick="toggleCheckboxes(this);" name="ref" type="checkbox" /><label for="ref">Click me</label>
<input name="check1" type="checkbox" value="1" /><label for="ref">One</label>
<input name="check2" type="checkbox" value="2" /><label for="ref">Two</label>
<input name="check3" type="checkbox" value="3" /><label for="ref">Three</label>
<input name="check4" type="checkbox" value="4" /><label for="ref">Four</label>
<input name="check5" type="checkbox" value="5" /><label for="ref">Five</label>
    </form>
</pre>
<p>Copy and save the page as myfile.html to see how it works!</p>
<h2 class="subhead">Conclusion</h2>
<p>While other JavaScript libraries indeed have similar functions, I really like the inherent flexibility of <code>getElementsBy</code>. The beauty of YUI is that it works like JavaScript is supposed to work, it&#8217;s written they way JavaScript is written. And you don&#8217;t have to memorize a whole new syntax or funky var language to use the power of YUI.</p>
<p>____________________________</p>
<p><em>K. Beau Beauchamp is a professional UI developer with over 15 year&#8217;s experience in graphic design, marketing communications and object-oriented UI programming. Beau can be contacted via email <a href="http://webtigers.net/contact/">here</a>.</em></p>
<h2 class="subhead" style="text-align: center;"><span style="color: #999999;">&#x0416;</span></h2>
]]></content:encoded>
			<wfw:commentRss>http://webtigers.net/articles/yui-getelementsby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing Clean Code</title>
		<link>http://webtigers.net/featured/writing-clean-code/</link>
		<comments>http://webtigers.net/featured/writing-clean-code/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 09:05:02 +0000</pubDate>
		<dc:creator>K. Beau Beauchamp</dc:creator>
				<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://webtigers.net/?p=158</guid>
		<description><![CDATA[Coming soon &#8230; How to write &#8220;clean code&#8221; for professional applications.]]></description>
			<content:encoded><![CDATA[<p>Coming soon &#8230; How to write &#8220;clean code&#8221; for professional applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://webtigers.net/featured/writing-clean-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

