<?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>Benedict Graphico &#124; lab</title>
	<atom:link href="http://lab.benedictgraphico.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lab.benedictgraphico.com</link>
	<description>Experiments and Examples in Graphics and Code</description>
	<lastBuildDate>Thu, 28 Feb 2008 05:07:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MooTools Initial Load Issue</title>
		<link>http://lab.benedictgraphico.com/web-design/mootools-initial-load-issue/</link>
		<comments>http://lab.benedictgraphico.com/web-design/mootools-initial-load-issue/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 18:53:57 +0000</pubDate>
		<dc:creator>John Benedict</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://lab.benedictgraphico.com/web-design/mootools-initial-load-issue/</guid>
		<description><![CDATA[While adding a basic show/hide feature to a client&#8217;s website, I ran across a rather annoying issue. I&#8217;m refraining from calling it a bug, as the issue was only replicable on Internet Explorer 6 and 7 on PC. Surprise, surprise. The show/hide feature is basically the Toggle Effect demonstrated on MooTools&#8217; Fx.Slide Demo. My client [...]]]></description>
			<content:encoded><![CDATA[<p>While adding a basic show/hide feature to a client&#8217;s website, I ran across a rather annoying issue. I&#8217;m refraining from calling it a bug, as the issue was only replicable on Internet Explorer 6 and 7 on PC. Surprise, surprise.</p>
<p>The show/hide feature is basically the Toggle Effect demonstrated on <a href="http://demos.mootools.net/Fx.Slide">MooTools&#8217; Fx.Slide Demo</a>. My client wanted to have a link in the footer of their site that, when clicked, would reveal a vertical list of internal site links &#8211; for SEO purposes.</p>
<p><a href="http://lab.benedictgraphico.com/lab-examples/mootools-initial-load-issue/mootools-initial-load-issue.html">Here&#8217;s an example of the list</a><br />
<span id="more-12"></span><br />
The code on MooTools&#8217; Demo translated to something like this for my client:</p>
<h5>The JavaScript:</h5>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mootools.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
//<span style="color: #009900;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #009900;">	window.addEvent<span style="color: #66cc66;">&#40;</span>\\<span style="color: #ff0000;">'domready\\'</span>, function<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">		var mySlide <span style="color: #66cc66;">=</span> new Fx.Slide<span style="color: #66cc66;">&#40;</span>\\<span style="color: #ff0000;">'linkMenu\\'</span><span style="color: #66cc66;">&#41;</span>.hide<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">		$<span style="color: #66cc66;">&#40;</span>\\<span style="color: #ff0000;">'toggle\\'</span><span style="color: #66cc66;">&#41;</span>.addEvent<span style="color: #66cc66;">&#40;</span>\\<span style="color: #ff0000;">'click\\'</span>, function<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">			e <span style="color: #66cc66;">=</span> new Event<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">			mySlide.toggle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">			e.stop<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">		<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">	<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;"><span style="color: #66cc66;">//</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<h5>The HTML:</h5>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;linkMenu&quot;</span>&gt;</span><span style="color: #ddbb00;">&amp;nbsp;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.ilovetypography.com/&quot;</span>&gt;</span>ilovetypography<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.freelanceswitch.com/&quot;</span>&gt;</span>freelance switch<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.cssglobe.com/&quot;</span>&gt;</span>css globe<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.stylegala.com/&quot;</span>&gt;</span>stylegala<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.alistapart.com/&quot;</span>&gt;</span>a list apart<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.underconsideration.com/speakup/&quot;</span>&gt;</span>speak up<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.37signals.com/svn/&quot;</span>&gt;</span>svn<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://webtypography.net/&quot;</span>&gt;</span>webtypography<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.faveup.com/&quot;</span>&gt;</span>faveup<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.logopond.com/&quot;</span>&gt;</span>logopond<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.surfshot.com/&quot;</span>&gt;</span>surfshot<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.wetsand.com/&quot;</span>&gt;</span>wetsand<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.surfline.com/&quot;</span>&gt;</span>surfline<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.wannasurf.com/&quot;</span>&gt;</span>wannasurf<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div>

<p>As I stated before, my client wanted the list of links to be hidden unless the Toggle link was clicked. Simply adding .hide() to the end of the mySlide variable definition hid the list of links on most browsers, but not the initial load on Internet Explorer 6 or 7. However, after one page refresh, both IE 6 and 7 worked as they should.</p>
<p>After spending some time searching Google for a solution, I came up with an idea: use CSS to hide the list, then use JavaScript to make it visible again.</p>
<h5>CSS to hide the list</h5>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#linkMenu</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<h5>JavaScript to show the list</h5>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">// placed directly under window.addEvent('domready', function(){
$('linkMenu').setStyle('display', 'block');</pre></div></div>

<p>The only issue I see from this solution has to do with SEO best practices. 456 Berea St. has a good article and some resource on &#8220;<a href="http://www.456bereastreet.com/archive/200510/google_seo_and_using_css_to_hide_text/">Google, SEO and using CSS to hide text</a>.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.benedictgraphico.com/web-design/mootools-initial-load-issue/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simple Ajax Contact Form</title>
		<link>http://lab.benedictgraphico.com/web-design/simple-ajax-contact-form/</link>
		<comments>http://lab.benedictgraphico.com/web-design/simple-ajax-contact-form/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 19:30:57 +0000</pubDate>
		<dc:creator>John Benedict</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://lab.benedictgraphico.com/web-design/simple-ajax-contact-form/</guid>
		<description><![CDATA[This tutorial, or should I say example, is a very Simple Ajax Contact Form. But don&#8217;t let the simplicity fool you. This form can communicate with a PHP Mail Script without having to refresh the page, validate user input on both the client and server sides, work even if the user has JavaScript disabled and [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial, or should I say example, is a very Simple Ajax Contact Form. But don&#8217;t let the simplicity fool you. This form can communicate with a PHP Mail Script without having to refresh the page, validate user input on both the client and server sides, work even if the user has JavaScript disabled and will use a nifty little trick to combat Spam.</p>
<p>Nothing in this tutorial is truly original or developed by myself. I&#8217;ve compiled the ideas and concepts that I use whenever I need an Ajax Form. I am not claiming creative recognition or ownership of these ideas, and I (try to) give full credit to the original authors of each. I simply hope to provide a resource that some may find useful.</p>
<p>Here&#8217;s a <a href="http://lab.benedictgraphico.com/lab-examples/simple-ajax-contact-form/simple-form.php">demo</a> to check out.<br />
<span id="more-7"></span><br />
The Ajax part of this tutorial will be handled by <a href="http://mootools.net">MooTools</a> (my favorite JavaScript Library) and will expand upon the <a href="http://demos.mootools.net/Ajax.Form">Ajax Form</a> presented in their demo section.</p>
<p><a href="http://www.roscripts.com/AJAX_contact_form-144.html">Ro Scripts&#8217; AJAX Contact Form</a> is the major source of this form&#8217;s inspiration. This is the best tutorial for creating an Ajax Form I&#8217;ve found so far, and I highly recommend giving it a read through. <a href="http://www.dustindiaz.com/ajax-contact-form/">Dustin Diaz’s Ajax Contact Form</a> is also interesting and worth checking out.</p>
<p>The client side form validation is handled by Fabio Zendhi Nagao&#8217;s <a href="http://zendold.lojcomm.com.br/fvalidator/">fValidator</a>, which also uses MooTools. This script is very well documented, so if you need help with it, check out the <a href="http://zendold.lojcomm.com.br/fvalidator/#selflink_usage">usage</a> and <a href="http://zendold.lojcomm.com.br/fvalidator/#selflink_examples">examples</a>.</p>
<h5>The HTML Form</h5>
<p>A pretty basic HTML Form. Be sure to take note of the ID and Class names on the Form, Inputs and in one instance an Li tag. You can lay out your Form anyway you&#8217;re comfortable with, but you&#8217;ll soon see why having each Label/Input nested in an Li tag proves useful.</p>
<p>The Div &#8216;log&#8217; is used to display messages from the PHP Script, and &#8216;log-res&#8217; will be used to show an Animated GIF image while the form is being processed. For Loading Animated GIFs, check out <a href="http://www.ajaxload.info/">Ajax Load</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;send.php&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fValidator-form&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">fieldset</span>&gt;</span>	
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ol</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;firstName&quot;</span>&gt;</span>First Name<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;firstName&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm_firstName&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fValidate['required']&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;lastName&quot;</span>&gt;</span>Last Name<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;lastName&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm_lastName&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fValidate['required']&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Email&quot;</span>&gt;</span>E-Mail<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Email&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm_Email&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fValidate['required','email']&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;human&quot;</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;subject&quot;</span>&gt;</span>Subject<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;subject&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm_subject&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;message&quot;</span>&gt;</span>Message<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;message&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm_message&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fValidate['required']&quot;</span> <span style="color: #000066;">rows</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">cols</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">textarea</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ol</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">fieldset</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm_submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;reset&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Reset&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;log&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;log_res&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!-- spanner --&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<h5>The PHP Script</h5>
<p>This is a slightly modified version of the PHP Mail Script <a href="http://www.roscripts.com/AJAX_contact_form-144.html">Ro Scripts&#8217; AJAX Contact Form</a> is using. If you need an explanation, check their tutorial.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> valid_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subject'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Dirty Spammer! Your message was NOT sent.'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'firstName'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lastName'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> valid_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #009900; font-weight: bold;">TRUE</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$to</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'you@youremail.com'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> 	<span style="color: #0000ff;">'From: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">.</span>
				<span style="color: #0000ff;">'Reply-To: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">.</span>
				<span style="color: #0000ff;">'X-Mailer: PHP/'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">phpversion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Your Simple AJAX Contact Form&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$spam</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subject'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$to</span><span style="color: #339933;">,</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//we show the good guy only in one case and the bad one for the rest.</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Thank you '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'firstName'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'. Your message was sent.'</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;noscript&gt; &lt;a href=&quot;http://www.yourdomain.com&quot;&gt;Back to yourdomain.com&lt;/a&gt;&lt;/noscript&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Message not sent.&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Please make sure you're not running this on localhost and also that you are allowed to run mail() function from your webserver.&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Please make sure you filled in all the required fields, that you entered a valid email and also that your message contains more then 15 characters.&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;noscript&gt; Use your browser's back button or &lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://www.yourdomain.com<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;click here&lt;/a&gt;&lt;/noscript&gt; to try again.&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h5>Loading MooTools and fValidator</h5>
<p>Just before the closing Head tag, you need to call MooTools, fValidator and insert the proper JavaScript to tell fValidator and MooTools what to do with your form.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mootools.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fValidator.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
//<span style="color: #009900;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #009900;">	window.addEvent<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'domready'</span>, function<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">		<span style="color: #66cc66;">//</span> fValidator</span>
<span style="color: #009900;">		var myFormValidator <span style="color: #66cc66;">=</span> new fValidator<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'myForm'</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">		<span style="color: #66cc66;">//</span> AJAX Form		</span>
<span style="color: #009900;">		$<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'myForm'</span><span style="color: #66cc66;">&#41;</span>.addEvent<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'submit'</span>, function<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">		if<span style="color: #66cc66;">&#40;</span>myFormValidator._onSubmit<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">			new Event<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span>.stop<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">			var log <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'log_res'</span><span style="color: #66cc66;">&#41;</span>.empty<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.addClass<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'ajax-loading'</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">			this.send<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">				update: log,</span>
<span style="color: #009900;">				onComplete: function<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">					log.removeClass<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'ajax-loading'</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">			<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">		<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">		<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">		<span style="color: #66cc66;">//</span> Reset</span>
<span style="color: #009900;">		$<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'myForm'</span><span style="color: #66cc66;">&#41;</span>.addEvent<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'reset'</span>, function<span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">			var log <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'log_res'</span><span style="color: #66cc66;">&#41;</span>.empty<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">		<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;		</span>
<span style="color: #009900;">	<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;"><span style="color: #66cc66;">//</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></pre></div></div>

<h5>Non-JavaScript Functionality</h5>
<p>You may notice that the PHP Script checks for valid input. The user&#8217;s email is checked using a <a href="http://www.roscripts.com/PHP_regular_expressions_examples-136.html">PHP Regular Expression</a> in the Function valid_email($str). The other inputs can be anything really, so isset($_POST['']) is used with the addition of strlen($_POST['message'])>15) added, to check for the amount of characters in the message. The value 15 is used, but feel free to change this to suit your needs.</p>
<p>These simple checks ensure that if users have JavaScript disabled, our form will still be validated. However, instead of the message being displayed via Ajax on our form page, users will be taken to blank white page with the message displayed.</p>
<p>Then, using the noscript tag, we can insert some code that only Non-JavaScript users will see. In this case, I kept it simple, and only included directions on which actions to take.</p>
<p>Particle Tree&#8217;s <a href="http://particletree.com/features/degradable-ajax-form-validation/">Degradable Ajax Form Validation</a> may be useful if you&#8217;d like to extend beyond this basic functionality. Ro Scripts also has a good article about <a href="http://www.roscripts.com/Unobtrusive_Ajax_PHP_form_validation-188.html">Unobtrusive Ajax/PHP form validation</a>.</p>
<h5>Combatting Spam</h5>
<p>I&#8217;m not sure where I ran across this little nugget, but it has proven invaluable. Looking back at our HTML Form, you may remember being reminded to take note of one Li instance. I was referring to the Li tag with the Class &#8216;human&#8217;. Using CSS, I&#8217;ve hidden this Li from view &#8211; visibility: hidden; . Essentially making the filling out of this field impossible. Unless of course you&#8217;re a Spam Bot. A Spam Bot will fill out our Inputs based on their Names. I named our Spam Blocking Input &#8216;subject&#8217;.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;human&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;subject&quot;</span>&gt;</span>Subject<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;subject&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myForm_subject&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span></pre></div></div>

<p>Here&#8217;s the <a href="http://lab.benedictgraphico.com/lab-examples/simple-ajax-contact-form/form.css">CSS File</a> used.</p>
<p>Now look at the following PHP:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subject'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Dirty Spammer! Your message was NOT sent.'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>In plain English: if the Input named &#8216;subject&#8217; is filled with anything, a message to the Spammer is given, and the Form is not sent. If the &#8216;subject&#8217; Input is NOT filled with anything, our PHP Script runs as it should.</p>
<p><a href="http://lab.benedictgraphico.com/lab-examples/simple-ajax-contact-form/simple-form-spam.php">Give it a try</a>, fill out the Form Fields correctly, with and without the &#8216;subject&#8217; Input.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.benedictgraphico.com/web-design/simple-ajax-contact-form/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Word It &#8211; Under</title>
		<link>http://lab.benedictgraphico.com/graphic-design/word-it-under/</link>
		<comments>http://lab.benedictgraphico.com/graphic-design/word-it-under/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 18:42:50 +0000</pubDate>
		<dc:creator>John Benedict</dc:creator>
				<category><![CDATA[Graphic Design]]></category>

		<guid isPermaLink="false">http://lab.benedictgraphico.com/graphic-design/word-it-under/</guid>
		<description><![CDATA[I love these things. Speak Up&#8217;s Word Its are great. Every month they come up with a new word for their community to work on. They get the conceptual juices flowing, design exercise if you will.]]></description>
			<content:encoded><![CDATA[<p><img src="http://lab.benedictgraphico.com/wp-content/uploads/2008/02/under-johnbenedict.jpg" alt="Word It - February 2008 - Under" /></p>
<p>I love these things. <a href="http://www.underconsideration.com/speakup/">Speak Up&#8217;s</a> Word Its are great. Every month they come up with a new word for their community to work on. They get the conceptual juices flowing, design exercise if you will.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.benedictgraphico.com/graphic-design/word-it-under/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://lab.benedictgraphico.com/news-updates/hello-world/</link>
		<comments>http://lab.benedictgraphico.com/news-updates/hello-world/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 03:42:41 +0000</pubDate>
		<dc:creator>John Benedict</dc:creator>
				<category><![CDATA[News & Updates]]></category>

		<guid isPermaLink="false">http://lab.benedictgraphico.com/?p=4</guid>
		<description><![CDATA[My first post on my long overdue blog. I&#8217;ll be posting on a somewhat regular basis &#8211; probably no more than 2–3 times per week on a variety of topics with varying degrees of scope. Mostly directed to Graphic and Web Designers, these posts will cover Freelancing Issues and Solutions, Tutorials and Examples of, Experiments [...]]]></description>
			<content:encoded><![CDATA[<p>My first post on my long overdue blog. I&#8217;ll be posting on a somewhat regular basis &#8211; probably no more than 2–3 times per week on a variety of topics with varying degrees of scope. Mostly directed to Graphic and Web Designers, these posts will cover Freelancing Issues and Solutions, Tutorials and Examples of, Experiments with Type, Imagery, Flash and Web Technologies, Free and Paid-for WordPress Themes, Lists of things I find useful and News that affects me and my business.</p>
<p>I don&#8217;t claim to be the best, or know the most, but over the time I&#8217;ve spent learning, experimenting and working in Graphic and Web Design, I&#8217;ve found ideas, practices and solutions that work for me. A lot of which I&#8217;ve taken from the Open Source and Free Internet Communities, and in a way, this blog is my way of giving back.</p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://lab.benedictgraphico.com/news-updates/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 2.078 seconds -->
