<?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>Adam Magaña</title>
	<atom:link href="http://adammagana.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://adammagana.com</link>
	<description>Code, Photos, Life</description>
	<lastBuildDate>Sat, 24 Sep 2011 17:58:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Kayla Boye</title>
		<link>http://adammagana.com/2011/09/kayla-boye/</link>
		<comments>http://adammagana.com/2011/09/kayla-boye/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 15:31:51 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Photos]]></category>

		<guid isPermaLink="false">http://adammagana.com/?p=74</guid>
		<description><![CDATA[Model: Kayla Boye Camera: Canon 5D Mk II Lens: 50mm 1.4]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a rel="lightbox" href="http://farm3.static.flickr.com/2060/5795245238_0b44b88eb7_b.jpg" title="Kayla Boye"><img class="aligncenter" title="Kayla Boye" src="http://farm3.static.flickr.com/2060/5795245238_0b44b88eb7_b.jpg" alt="Kayla Boye" /></a></p>
<p class="photo_detail">Model: <a href="http://www.flickr.com/photos/kaylaboye/">Kayla Boye</a></p>
<p class="photo_detail">Camera: Canon 5D Mk II</p>
<p class="photo_detail">Lens: 50mm 1.4</p>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://adammagana.com/2011/09/kayla-boye/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Form Validator: A jQuery Plugin!</title>
		<link>http://adammagana.com/2011/08/html-form-validator-a-jquery-plugin/</link>
		<comments>http://adammagana.com/2011/08/html-form-validator-a-jquery-plugin/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 22:04:52 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://adammagana.com/?p=5</guid>
		<description><![CDATA[A few months back I authored a simple, extensible jQuery plugin for easy form validation. There are plenty of awesome form validation tools out there but I wanted something that could be extensible with customizable validation patterns, customizable callback success/error functions, &#8230; <a href="http://adammagana.com/2011/08/html-form-validator-a-jquery-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A few months back I authored a simple, extensible jQuery plugin for easy form validation. There are plenty of awesome form validation tools out there but I wanted something that could be extensible with customizable validation patterns, customizable callback success/error functions, and something I could learn from <img src='http://adammagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you prefer to just read the source then feel free to fork it on <a href="https://github.com/adammagana/Easy-Form-Validator">GitHub</a> and have at it. Otherwise, here we go!</p>
<h1><span id="more-5"></span></h1>
<h1>Basic Usage:</h1>
<h2>HTML</h2>
<p>In the markup below you&#8217;ll see a standard HTML form with one minor exception. Each field element has a <code>data-validate</code> attribute. This attribute tells the validator plugin which pattern to match against. For instance, if the field has <code>data-validate="email"</code> then the field&#8217;s value will be matched against an email pattern.<br />
<script type="text/javascript" src="https://gist.github.com/1166698.js?file=gistfile1.html"></script>A complete list of all validation types (as of writing this) is as follows:</p>
<ul>
<li><strong>required</strong> &#8211; enforces that a field has been filled in</li>
<li><strong>alpha</strong> &#8211; enforces that a field contains only alphabetic characters</li>
<li><strong>numeric</strong> &#8211; enforces that a field contains only numeric characters</li>
<li><strong>email</strong> &#8211; enforces that a field contains a proper email address</li>
<li><strong>url</strong> &#8211; enforces that a field contains a proper URL</li>
</ul>
<p>    </p>
<h2>Javascript</h2>
<p>The Javascript usage of the validator is also very easy. You simply invoke the <code>validate()</code> method on your form&#8217;s selector. This method listens for a <code>submit</code> event on the form and matches field values against all of the corresponding <code>data-validate</code> attributes. In the example below we also pass a small object literal to the <code>validate()</code> method. This literal specifies a special callback function (<code>fieldError</code>) to be invoked when the validator finds an invalid field.<script type="text/javascript" src="https://gist.github.com/1166715.js?file=gistfile1.js"></script><br />
Note &#8211; You may also notice that the scope of the <code>fieldError</code> function is in terms of the invalid field: allowing <code>'this'</code> to refer to the field in question.</p>
<p>Also Note &#8211; The <code>fieldError</code> method is only one of three possible callbacks. There are also general <code>success</code> and <code>error</code> callback functions. These are invoked when an entire form has either completed successfully or contains validation errors.</p>
<h2>Try It Out</h2>
<p>For basic usage that&#8217;s all it takes! A valid form will submit just like normal and an invalid form will handle the errors any way you specify. Just mix in a few nifty CSS classes for marking fields with errors and you&#8217;ve got something worth using <img src='http://adammagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<iframe style="width: 100%; height: 300px; border: 1px solid #000;" src="http://jsfiddle.net/adammagana/Uk4HE/embedded/" width="320" height="240"></iframe></p>
<h1>Advanced Usage:</h1>
<h2>Custom Validation</h2>
<p>In order to define your own, custom validation type you must be aware of the <code>validationHooks</code> object literal that the plugin utilizes. Each validation type (or validation hook) has two items: a <code>set</code> item and a <code>message</code> item. The <code>set</code> item is the function to be invoked to validate a field&#8217;s value, returning <code>true</code> on successful validation and <code>false</code> on unsuccessful validation. The <code>message</code> item is the error message to be used when that validation fails.</p>
<p>The <code>validationHooks</code> object literal was inspired by jQuery&#8217;s <a href="http://api.jquery.com/jQuery.cssHooks/">CSS Hooks</a> implementation. I suggest checking out how that works if you&#8217;re not completely clear how this is being done <img src='http://adammagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here is an example of how a custom validation type would be constructed:<br />
<strong>HTML</strong><br />
<script type="text/javascript" src="https://gist.github.com/1167158.js?file=gistfile1.html"></script><strong>Javascript</strong><script type="text/javascript" src="https://gist.github.com/1167159.js?file=gistfile1.js"></script><br />
The custom validation created here validates whether or not the user has type the word &#8220;Awesome&#8221; in the field <img src='http://adammagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h1>Conclusion</h1>
<p>There you have it, folks. That should be enough to get you through 90% of any validation you may need. However, if you wish to get your hands dirty and dig into the source feel free to fork it on <a href="https://github.com/adammagana/Easy-Form-Validator">GitHub</a> and contribute. There&#8217;s always more work to be done <img src='http://adammagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://adammagana.com/2011/08/html-form-validator-a-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

