<?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>Design Shack &#187; form</title>
	<atom:link href="http://designshack.net/tag/form/feed" rel="self" type="application/rss+xml" />
	<link>http://designshack.net</link>
	<description>Inspiration, CSS Gallery &#38; Community News</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Creating a Shaking Login Form</title>
		<link>http://designshack.net/articles/creating-a-shaking-login-form/</link>
		<comments>http://designshack.net/articles/creating-a-shaking-login-form/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 14:46:56 +0000</pubDate>
		<dc:creator>Kishore Nallan</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[buzzing]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[shaking]]></category>
		<category><![CDATA[vibrating]]></category>

		<guid isPermaLink="false">http://designshack.co.uk/?p=944</guid>
		<description><![CDATA[Tired of the plain old boring login forms? How about we add some jazz! If you have ever typed in your password wrongly on your Mac, you would have seen that the login screen will vibrate and kinda shriek to indicate that the password you entered is wrong. I always found that rather cool! It’s [...]]]></description>
			<content:encoded><![CDATA[<p>Tired of the plain old boring login forms? How about we add some jazz! If you have ever typed in your password wrongly on your Mac, you would have seen that the login screen will vibrate and kinda shriek to indicate that the password you entered is wrong. I always found that rather cool! It’s surprising how little this trick is being used in web applications today. So, I thought I will write up a tutorial on how to get this going.</p>
<p><span id="more-944"></span></p>
<p>Before we get started, feel free to check out the <a href="http://designshack.net/tutorialexamples/buzzinglogin/index.html">finished example</a>.</p>
<p>As you might have already guessed, this will require some JavaScript magic, or more specifically jQuery vodoo. I am trying my best not to go into a rant on the wonderfulness of jQuery right now (I am sure you already knew that anyway!), so let me just say that it gets the job done, and easily.</p>
<p>So, here goes! As I got started on this, the first thing I did was to have a look at how best to implement the shaking or vibrating effect on the login form. I suspected that it might be part of the jQuery effects library, and yes, there was a shake() function, but  I also stumbled on a nice plugin by <a href="http://exscale.se/archives/2008/03/27/jquery-vibrate-plug-in/">Andreas Lagerkvist</a>, which did just about the same thing. I chose the plugin approach as it was the lightweight way to go.</p>
<p>The actual implementation is pretty straightforward.  We have a plain form, wrapped in a DIV which we will label as login.</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;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span>&gt;</span>	
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>Buzzing Login form<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
	<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;&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&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;username&quot;</span>&gt;</span>Username:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
&nbsp;
		<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;pwd&quot;</span>&gt;</span>Password:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</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>			
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>We next include the jQuery related JavaScript files in the head of the document.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;jquery-1.3.2.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;vibrate.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Using jQuery, we will then set-up an onclick event handler on the submit button . We will process the login form and take an appropriate action using this function.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#submit_butt&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// configurations for the buzzing effect. Be careful not to make it too annoying!</span>
		<span style="color: #003366; font-weight: bold;">var</span> conf <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
				frequency<span style="color: #339933;">:</span> <span style="color: #CC0000;">5000</span><span style="color: #339933;">,</span>
				spread<span style="color: #339933;">:</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span>
				duration<span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span>
			<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">/* do your AJAX call and processing here...
			....
			....
		*/</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// this is the call we make when the AJAX callback function indicates a login failure </span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#login&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">vibrate</span><span style="color: #009900;">&#40;</span>conf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// let's also display a notification</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#errormsg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loginform&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;p id=&quot;errormsg&quot;&gt;Invalid username or password!&lt;/p&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// clear the fields to discourage brute forcing :)</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#username&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#pwd&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Define a set of configuration variables that define the nature of the buzzing effect. In case the login fails, just make a call to the vibrate() function using the configuration variables as parameter. A general word of caution – make sure you don’t have the buzzing effect in action for too long, as it might be irritating to the user if the form buzzes for a long time! I found a duration of 500ms comfortable. In addition, we also display a warning message to the user, and then proceed to clear the input fields. </p>
<p>And it’s as simple as that! <a href="http://www.designshack.net/tutorialexamples/buzzinglogin/">You have a nifty login form ready.</a></p>
<p>On a final note, I have made a minor modification to Andreas’ original plugin to suit our application. The changes are documented on the code. </p>
<p>Try it out, and let us know how it works. If you get this implemented somewhere, do post up a link in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/creating-a-shaking-login-form/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Creating a Digg Style Sign Up Form</title>
		<link>http://designshack.net/articles/creating-a-digg-style-sign-up-form/</link>
		<comments>http://designshack.net/articles/creating-a-digg-style-sign-up-form/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 11:19:12 +0000</pubDate>
		<dc:creator>Janko Jovanovic</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[digg]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[signup]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://localhost:8888/?p=137</guid>
		<description><![CDATA[Digg.com is one of the most popular social networking sites, allowing you to discover and share the content all over the web. In this tutorial we are going to simulate their signup form, with unique features such as their dynamic tooltips that give you a hint on each field that is to be filled. The [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://digg.com/">Digg.com</a> is one of the most popular social networking        sites, allowing you to discover and share the content all over the web. In this tutorial we are going to simulate their signup form, with unique features such as their dynamic tooltips that give you a hint on each field that is to be filled. The same approach will be adopted for displaying validation messages.</p>
<p>
Before we get started, you may like to <a href="http://www.designshack.net/tutorialexamples/diggform/" target="_blank">view a demo</a> of the end result.
</p>
<h2>
        How this form works?</h2>
<p>
        When an input field receives focus, a tooltip with a small blue icon is shown under it.         On the other hand, if validation fails, an error message is shown in the same place. Both cases are shown on the screenshot below.</p>
<p>
        <img height="138" alt="digg-field" src="http://www.designshack.net/postimages/digg-field.png" width="539" border="0">
    </p>
<h2>
        Let&#8217;s start</h2>
<p>
        We are not going to recreate the entire form, but rather a few fields just to see        how it works. Let&#8217;s take a closer look at the code sample. Each field row has        a label, an input field, an info message and a validation message. Below you can see the        HTML structure and CSS classes.</p>
<p>
        Note that, by default, both info and validation messages are hidden, which is set        in tooltipContainer CSS class.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">fieldset</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span>“formContainer”&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>Join Now! It’s quick and easy.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span>“rowContainer”&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>“txtFirstname”&gt;</span>Choose a username<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;">id</span><span style="color: #66cc66;">=</span>“txtFirstname” <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span>“<span style="color: #000066;">text</span>” <span style="color: #66cc66;">/</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span>“tooltipContainer info”&gt;</span>Minimum 4 characters, maximum 15 characters. This is your handle on Digg so don’t make it too personal.<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: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span>“tooltipContainer error”&gt;</span>Rats! Username must be between 4 and 15 characters.<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>
   // other rows here
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">fieldset</span>&gt;</span> 
&nbsp;
body{
    font-family:Arial, Sans-Serif;
    font-size:83%;
}
.formContainer
{
    background-color: #F5EFC9;
    border:none;
    padding:30px;
}
.formContainer h3
{
    margin:0px;
    padding:0px 0px 10px 0px;
    font-size:135%;
}
.rowContainer
{
    width:100%;
    overflow:hidden;
    padding-bottom:5px;
    height:34px;
}
.rowContainer label
{
    width:140px;
    float:left;
    color: #758656;
    font-weight:bold;
}
.rowContainer input[type=“text”]
{
    width:200px;
}
.tooltipContainer
{
    height:16px;
    font-size:11px;
    color: #666666;
    display:none;
    float:none;
    background-repeat:no-repeat;
    background-position:left center;
    padding:0px 20px;
}
.info
{
    background-image:url(‘info.gif’);
}
.error
{
    background-image:url(‘error.gif’);
}</pre></td></tr></table></div>

<h2>
        Now let&#8217;s add some interactivity</h2>
<p>
        So far we have a static HTML structure and hidden messages waiting to be shown.  We have to write a few lines of code to make them appear/disappear. Of course, this can be accomplished by pure JavaScript, but let&#8217;s involve jQuery. The reason for this is quite simple &#8211; less coding.</p>
<p>
        Like I mentioned at the beginning of this tutorial, an info tooltip should be shown        each time an input field gets focus and hidden when it loses it. Turn this into jQuery        code and you get this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">formContainer</span> input<span style="color: #009900;">&#91;</span>type<span style="color: #339933;">=</span>text<span style="color: #009900;">&#93;</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">info</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span>“display”<span style="color: #339933;">,</span> “block”<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">info</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span>“display”<span style="color: #339933;">,</span> “none”<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>
        Simple, isn&#8217;t it? Now, let&#8217;s see how to handle validation messages. We are        going to create fake validation just for the purpose of this tutorial. We&#8217;ll        use jQuery again.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> validateForm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">formContainer</span> input<span style="color: #009900;">&#91;</span>type<span style="color: #339933;">=</span>text<span style="color: #009900;">&#93;</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> text <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span>“value”<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>text <span style="color: #339933;">==</span> “”<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">error</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span>“display”<span style="color: #339933;">,</span> “block”<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>
        In essence, what the code above does is it shows a validation message for each field        that the user hasn&#8217;t entered text in. Please keep in mind that this is not real validation,        it just simulates what would happen if validation failed. You would have to implement        your own logic, eg. check for mandatory fields, email address format and so        on.</p>
<p>
        Ok, after pressing the sign-in button, validation messages will be shown. Signup        form on Digg.com hides these messages and replaces them with info tooltips when the user        starts to type. So we are missing a piece of code that will hide validation messages        that were previously shown.</p>
<p>
        Let&#8217;s do it the dirty way. We&#8217;ll extend our jQuery code that controls the appearance        of tooltips to hide corresponding validation messages each time an input field gets        focus.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">formContainer</span> input<span style="color: #009900;">&#91;</span>type<span style="color: #339933;">=</span>text<span style="color: #009900;">&#93;</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">error</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span>“display”<span style="color: #339933;">,</span> “none”<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">info</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span>“display”<span style="color: #339933;">,</span> “block”<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span>”.<span style="color: #660066;">info</span>”<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span>“display”<span style="color: #339933;">,</span> “none”<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>
        This way we have recreated the Digg.com signup form. You can check out <a href="http://www.designshack.net/tutorialexamples/diggform/" target="_blank">live demo</a>   or <a href="http://www.designshack.net/tutorialexamples/diggform/diggform.zip">download full source code</a>.</p>
<h2>
        Conclusion</h2>
<p>
        You saw how to recreate the Digg.com signup form with simple CSS and just        a few lines of jQuery code. However, there are a few pieces of advice I&#8217;d like to give you:</p>
<ul>
<li>Do not overwork the form &#8211; there is really no need for a tooltip that says &#8220;Enter            your first and last name in the field that says First and Last name&#8221;. Instead, you            can provide a message that shows a constraint, for example &#8220;Maximum 35 characters&#8221;.</li>
<li>Use tooltip/validation color other that text color &#8211; try hitting the &#8220;Continue&#8221; button            on Digg.com signup form before entering any text. The form becomes very hard to            read and it&#8217;s difficult to distinguish where one field ends and the next begins.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/creating-a-digg-style-sign-up-form/feed/</wfw:commentRss>
		<slash:comments>72</slash:comments>
		</item>
		<item>
		<title>10 CSS Form Examples</title>
		<link>http://designshack.net/articles/10-css-form-examples/</link>
		<comments>http://designshack.net/articles/10-css-form-examples/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 16:48:13 +0000</pubDate>
		<dc:creator>David Appleyard</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Layouts]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[input]]></category>

		<guid isPermaLink="false">http://localhost:8888/?p=255</guid>
		<description><![CDATA[Forms can be greatly enhanced with a touch of CSS, making them more usable and far more visually attractive. Follow some of the examples below and you&#8217;ll be creating stunning CSS forms in no time at all. 1. Semantic Horizontal Form This form is coded in a semantic way and the elements are positioned next [...]]]></description>
			<content:encoded><![CDATA[<p>Forms can be greatly enhanced with a touch of CSS, making them more usable and far more visually attractive. Follow some of the examples below and you&#8217;ll be creating stunning CSS forms in no time at all.</p>
<p><span id="more-255"></span></p>
<h2>1. <a href="http://www.skyrocket.be/2006/01/09/semantic-horizontal-forms/">Semantic Horizontal Form</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/forms_css_1.jpg" alt="Horizontal CSS Semantic Form" class="tutorialimage" width="510" height="287" class="alignnone size-full wp-image-25346" /></p>
<p>This form is coded in a semantic way and the elements are positioned next to eachother except for the last fieldset which spans the full width of the form below the 3 top fieldsets. It’s been tested in FF1.x, IE6 and Opera8. (looks a little quirky in IE5.x but still usable) </p>
<h2>2. <a href="http://www.emblematiq.com/lab/niceforms/">Nice Forms</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/forms_css_2.jpg" alt="Nice Forms"  class="tutorialimage" /></p>
<p>A great form, with graphical elements and colour to create a different and unique look. All done with CSS and semantic coding.</p>
<h2>3. <a href="http://www.stylephreak.com/uploads/source/cssforms/cssform.php">StylePhreak Simple CSS Form</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/forms_css_3.jpg" alt="Simple CSS Form" width="510" height="275" class="tutorialimage" /></p>
<p>A simple form with regular alignment and unique lines to break up the different sections. This works well as a great base to start your own custom form from.</p>
<h2>4. <a href="http://veerle.duoh.com/index.php/blog/comments/styling_forms_in_css/">Veerle&#8217;s Blue CSS Form</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/forms_css_4.jpg" alt="Veerle Blue CSS Form" width="510" height="296"  class="tutorialimage" /></p>
<p>A simple blue form with rounded background corners, all styled in CSS and XHTML. The layout is pixel perfect, and the images can be customized to match your own requirements.</p>
<h2>5. <a href="http://www.assemblesoft.com/examples/form/">Who Says CSS Forms Can&#8217;t Be Pretty?</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/forms_css_51.jpg" alt="Who Says CSS Forms Can't Be Pretty?" title="forms_css_5" width="510" height="397" class="tutorialimage" /></p>
<p>A unique form with soft background images to complement the fields. It highlights many form possibilities, including a pop-up calendar for choosing a date. A <a href="http://www.assemblesoft.com/examples/form/simpleform.html">related tutorial</a> also accompanies the example.</p>
<h2>5. <a href="http://www.themaninblue.com/experiment/InForm/index.htm">Man in Blue: Form Examples</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/table.jpg" alt="Man in Blue: Form Examples" title="table" width="510" height="228" class="tutorialimage" /></p>
<p>Here I&#8217;ve made each fieldset extend the full width of the page. The main styling that&#8217;s going on is the positioning of the form elements within the fieldsets. Because each element is contained inside a label tag, you can just float labels left, give them a bit of margin, and they line up horizontally (moving to the next line if there&#8217;s not enough width).</p>
<h2>6. <a href="http://www.cssplay.co.uk/menu/form.html">CSS Play &#8211; A Form with Style</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/cssplay.jpg" alt="CSS Play Form" title="cssplay" width="510" height="315" class="tutorialimage" /></p>
<p>Forms are not very friendly when it comes to CSS and each browser has its own way of handling them. Styles that work in one browser will not work in another, so depending on which browser you are using you will see a slightly different interpretation.</p>
<h2>7. <a href="http://www.formassembly.com/form-garden.php?formId=29&#038;style=/form-builder/css/campground_2">The Form Garden</a></h2>
<p>This is a generic web form containing all the different fields and layouts available in FormAssembly.com. Use this form to make sure your theme works well with any type of web form.</p>
<h2>8. <a href="http://www.alistapart.com/articles/prettyaccessibleforms">Prettier Accessible Forms</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/prettiercssforms.jpg" alt="Prettier CSS Forms" width="510" height="308" class="tutorialimage" /></p>
<p>The most important part of a form is the HTML we use to build it. Fortunately, HTML gives us a nice assortment of tags to build our forms in an accessible way. These are fieldset, legend, and label.</p>
<h2>9. <a href="http://www.designplace.org/tutorials.php?page=1&#038;c_id=9">HTML Form Effects with CSS</a></h2>
<p>For this tutorial you should already be familiar with HTML forms and the various elements and attributes. You should also have a basic understanding of Cascading Stylesheets (CSS)</p>
<h2>10. <a href="http://www.websiteoptimization.com/speed/tweak/forms/">A 2 Column CSS Form Layout</a></h2>
<p><img src="http://designshack.net/wp-content/uploads/2column.jpg" alt="A 2 Column CSS Form Layout" width="510" height="273" class="tutorialimage" /></p>
<p>Websites have become less accessible and more complex over time according to recent studies. Learn how to buck the trend by creating fast, accessible CSS forms that work with modern browsers and gracefully degrade.</p>
<p><strong><em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/10-css-form-examples/feed/</wfw:commentRss>
		<slash:comments>138</slash:comments>
		</item>
		<item>
		<title>Search Forms in Safari</title>
		<link>http://designshack.net/articles/search-forms-in-safari/</link>
		<comments>http://designshack.net/articles/search-forms-in-safari/#comments</comments>
		<pubDate>Sun, 09 Sep 2007 19:50:03 +0000</pubDate>
		<dc:creator>David Appleyard</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://localhost:8888/?p=377</guid>
		<description><![CDATA[It is remarkably simple to put this design feature in place on your site, and it can improve functionality greatly for those using a Mac. Whether Firefox and Internet Explorer will integrate this feature into their browsers in the future is unknown &#8211; although it is fairly unlikely. How to turn the feature on Using [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.designshack.net/postimages/safarisearch.jpg" alt="Search fields in Safari" class="right" />It is remarkably simple to put this design feature in place on your site, and it can improve functionality greatly for those using a Mac. Whether Firefox and Internet Explorer will integrate this feature into their browsers in the future is unknown &#8211; although it is fairly unlikely.</p>
<h2>How to turn the feature on</h2>
<p>Using the following code for a form will cause the enhanced search field to display in Safari:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td 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;form.php&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span>&gt;</span>
<span style="color: #009900;">&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;search&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;search&quot;</span></span>
<span style="color: #009900;">autosave<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mysite-autosave&quot;</span> results<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> 
<span style="color: #009900;">&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;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Search&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;">form</span>&gt;</span></pre></td></tr></table></div>

<p>The <code>type="search"</code> tells safari to use the field as a search box, and the <code>autosave="mysite-autosave" results="10"</code> sets additional features about the recent search information.</p>
<h2>The downsides</h2>
<p>The negative aspect of adding this feature is that your code won&#8217;t validate. It&#8217;s up to you to decide whether it is a acceptable down-side of improving the browsing experience for those using Safari. We think it is &#8211; and you&#8217;ll see the enhanced search field on Design Shack!</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/search-forms-in-safari/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HTML Form Basics</title>
		<link>http://designshack.net/articles/html-form-basics/</link>
		<comments>http://designshack.net/articles/html-form-basics/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 13:25:07 +0000</pubDate>
		<dc:creator>David Appleyard</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[radio]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://localhost:8888/?p=461</guid>
		<description><![CDATA[HTML is used mainly for presenting and showcasing information for the visitor. But it&#8217;s also easy to allow them to enter information and use it in various ways. This tutorial uses the example of a contact form. Simple Contact Form Providing your web host supports PHP, you just need to follow our example below to [...]]]></description>
			<content:encoded><![CDATA[<p>HTML is used mainly for presenting and showcasing information for the visitor. But it&#8217;s also easy to allow them to enter information and use it in various ways. This tutorial uses the example of a contact form.</p>
<h2>Simple Contact Form</h2>
<p>Providing your web host supports PHP, you just need to follow our example below to email the contents of a form to yourself. Firstly, this is the HTML code to put on your page:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td 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;submit.php&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;get&quot;</span>&gt;</span>
   Name: <span style="color: #009900;">&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;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
   Email Address: <span style="color: #009900;">&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;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
   Message: <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>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">textarea</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
   <span style="color: #009900;">&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;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Send Form&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;">form</span>&gt;</span></pre></td></tr></table></div>

<p>This will result in a form which looks similar to the following:</p>
<form action="" method="get">
   Name:<br />
<input type="text" name="name" />
<p>   Email Address:<br />
<input type="text" name="email" />
<p>   Message:</p>
<p>   <textarea name="message"></textarea></p>
<input type="submit" value="Send Form" />
</form>
<p>So you&#8217;re able to collect the data. Now to explain how to email it. To do this, you need to make a file called <code>submit.php</code> and put it in the same folder as your HTML file. It&#8217;s quite complicated to go into exactly how this works, but if you copy and paste the following code it should work fine:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Website Message&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Someone sent you a message from your website:
Name: <span style="color: #006699; font-weight: bold;">$name</span>
Email: <span style="color: #006699; font-weight: bold;">$email</span>
Message: <span style="color: #006699; font-weight: bold;">$message</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$youremail</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;me@mywebsite.com&quot;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$youremail</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: #0000ff;">&quot;From: <span style="color: #006699; font-weight: bold;">$email</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Thankyou for filling in a form!'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>All you need to do is <b>change me@mywebsite.com to your actual email address</b>. You&#8217;ll be receiving form submissions from your website in no time!</p>
<h2>Other Form Options</h2>
<p>HTML doesn&#8217;t just use text fields for collecting information. You also have the option to use checkboxes, radio buttons and drop down lists. Feel free to take and use the examples below:</p>
<h2>Radio Buttons</h2>
<p>These allow you to enforce that the visitor only makes one choice, unlike checkboxes which allow you to select multiple answers/settings. They look something like:</p>
<form action="">
<input name="favouritecolor" type="radio" value="red" /> Red</p>
<input name="favouritecolor" type="radio" value="blue" /> Blue</p>
<input name="favouritecolor" type="radio" value="yellow" /> Yellow<br />
</form>
<p>The code you use to create the above is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><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;favouritecolor&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;radio&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;red&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> Red
<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;favouritecolor&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;radio&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blue&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> Blue
<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;favouritecolor&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;radio&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;yellow&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> Yellow</pre></td></tr></table></div>

<h2>Checkboxes</h2>
<p>Several checkboxes can be ticked, allowing multiple selections. It is as simple as changing the word <code>radio</code> above to say <code>checkbox</code>:</p>
<form action="">
<input name="favouritecolor" type="checkbox" value="red" /> Red</p>
<input name="favouritecolor" type="checkbox" value="blue" /> Blue</p>
<input name="favouritecolor" type="checkbox" value="yellow" /> Yellow<br />
</form>
<p>The code you use to create the above is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><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;favouritecolor&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;red&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> Red
<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;favouritecolor&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blue&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> Blue
<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;favouritecolor&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;yellow&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> Yellow</pre></td></tr></table></div>

<h2>Drop Down Boxes</h2>
<p>Drop down boxes work in a similar way to radio buttons, allowing the user to select one option. However, they save a great deal of space if you are dealing with a long list &#8211; selecting your country for example:</p>
<form action="">
<select name="favouritecolor">
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="yellow">Yellow</option>
<option value="green">Green</option>
<option value="pink">Pink</option>
</select>
</form>
<p>The code you use to create the above is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">select</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;favouritecolor&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;red&quot;</span>&gt;</span>Red<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blue&quot;</span>&gt;</span>Blue<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;yellow&quot;</span>&gt;</span>Yellow<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;green&quot;</span>&gt;</span>Green<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pink&quot;</span>&gt;</span>Pink<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">select</span>&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/html-form-basics/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Object Caching 430/502 objects using disk: basic

Served from: designshack.net @ 2012-02-09 15:08:44 -->
