<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: tabulation code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 21:49:39 GMT</pubDate>
    <description>DZone Snippets: tabulation code</description>
    <item>
      <title>Auto Tab //JavaScript Function</title>
      <link>http://snippets.dzone.com/posts/show/676</link>
      <description>&lt;a href="http://www.jsfromhell.com/forms/auto-tab"&gt;&lt;br /&gt;Auto tabulation of text inputs with maxlength setted&lt;br /&gt;&lt;br /&gt;Usage: just add the code on the end of your page or call it on the onload event (worse solution) and "the enter tabulation" will be added for all fields enclosed by the &lt;form&gt; tag.&lt;br /&gt;&lt;br /&gt;[UPDATED CODE AND HELP CAN BE FOUND HERE]&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;@REQUIRES &lt;a href="http://www.jsfromhell.com/geral/event-listener"&gt;Event-Listener&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//Requires http://www.jsfromhell.com/Geral/event-listener&lt;br /&gt;&lt;br /&gt;//+ Jonas Raoni Soares Silva&lt;br /&gt;//@ http://jsfromhell.com/forms/auto-tab [v1.0]&lt;br /&gt;&lt;br /&gt;autoTab = function(){&lt;br /&gt;	for( var d, f = ( d = document ).forms, i = f.length; i; addEventListener( f[--i], "keyup", function( e ){&lt;br /&gt;		var el, k = String.fromCharCode( e.key ), l = ( e = e.target ).value.length;&lt;br /&gt;		if ( l &gt;= ( e.getAttribute( "maxlength" ) || l + 1 ) &amp;&amp; /[\w&#192;-&#255; ]/.test( k ) ){&lt;br /&gt;			for( l = k = ( el = e.form.elements ).length; el[--k] != e; );&lt;br /&gt;			while( !(e = el[ k = ++k * ( k &lt; l ) ]).type || e.disabled );&lt;br /&gt;			e.focus();&lt;br /&gt;		}&lt;br /&gt;	} ) );&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 09 Sep 2005 05:11:24 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/676</guid>
      <author>jonasraoni (Jonas Raoni Soares Silva)</author>
    </item>
    <item>
      <title>Enter as tab //Javascript Function</title>
      <link>http://snippets.dzone.com/posts/show/423</link>
      <description>&lt;a href="http://jsfromhell.com/forms/enter-as-tab"&gt;&lt;br /&gt;Tabulation on fields through the enter key, i didnt allowed it to work on &lt;select&gt; and &lt;textarea&gt; since the enter is required to use this fields, so find a nice place to use it :]&lt;br /&gt;&lt;br /&gt;Usage: just add the code on the end of your page or call it on the onload event (worse solution) and "the enter tabulation" will be added for all fields enclosed by the &lt;form&gt; tag.&lt;br /&gt;&lt;br /&gt;[UPDATED CODE AND HELP CAN BE FOUND HERE]&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;@REQUIRES &lt;a href="http://jsfromhell.com/geral/event-listener"&gt;Event-Listener&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//Requires http://jsfromhell.com/geral/event-listener&lt;br /&gt;&lt;br /&gt;//+ Jonas Raoni Soares Silva&lt;br /&gt;//@ http://jsfromhell.com/forms/enter-as-tab [v1.0]&lt;br /&gt;&lt;br /&gt;enterAsTab = function(){&lt;br /&gt;	for( var f, i = ( f = document.forms ).length; i; addEventListener( f[--i], "keypress", function( evt ){&lt;br /&gt;		var el, l, k = evt.key == 13, e = evt.target;&lt;br /&gt;		if( k &amp;&amp; !/textarea|select/i.test( e.type ) &amp;&amp; !evt.preventDefault() ){&lt;br /&gt;			for( l = k = ( el = e.form.elements ).length; el[--k] != e; );&lt;br /&gt;			while( !(e = el[ k = ++k * ( k &lt; l ) ]).type || e.disabled );&lt;br /&gt;			e.focus();&lt;br /&gt;		}&lt;br /&gt;	} ) );&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;form action=""&gt;&lt;br /&gt;	&lt;p&gt;&lt;br /&gt;	&lt;input type="text" /&gt;&lt;br /&gt;	&lt;br /&gt;&lt;input type="text" /&gt;&lt;br /&gt;	&lt;br /&gt; &lt;input type="radio" name="aaa" /&gt; op&#231;&#227;o 1&lt;br /&gt;	&lt;input type="radio" name="aaa" checked="checked" /&gt; op&#231;&#227;o 2&lt;br /&gt;	&lt;br /&gt;&lt;textarea rows="3" cols="15"&gt;aaaaaa pode dar enter q ele naum pula hahah&lt;/textarea&gt;&lt;br /&gt;	&lt;br /&gt;&lt;select&gt;&lt;option&gt;op&#231;&#227;o blablablabla&lt;/option&gt;&lt;option&gt;op&#231;&#227;o bleblebleble&lt;/option&gt;&lt;/select&gt;&lt;br /&gt;	&lt;br /&gt;&lt;input type="text" /&gt;&lt;br /&gt;	&lt;/p&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;//&lt;![CDATA[&lt;br /&gt;&lt;br /&gt;enterAsTab();&lt;br /&gt;&lt;br /&gt;//]]&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 02 Jul 2005 02:43:56 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/423</guid>
      <author>jonasraoni (Jonas Raoni Soares Silva)</author>
    </item>
  </channel>
</rss>
