<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" 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/" > <channel><title>Comments on: Getting Loopy &#8211; Nested Javascript Loops</title> <atom:link href="http://skeymedia.com/getting-loopy-nested-javascript-loops/feed/" rel="self" type="application/rss+xml" /><link>http://skeymedia.com/getting-loopy-nested-javascript-loops/</link> <description>Blogging about Web Development and Website Management &#38; Monetization</description> <lastBuildDate>Sun, 11 Sep 2011 07:44:05 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.4</generator> <item><title>By: Brian Cummiskey</title><link>http://skeymedia.com/getting-loopy-nested-javascript-loops/comment-page-1/#comment-166</link> <dc:creator>Brian Cummiskey</dc:creator> <pubDate>Thu, 19 Oct 2006 06:23:40 +0000</pubDate> <guid isPermaLink="false">http://www.skeymedia.com/programming/javascript/getting-loopy-nested-javascript-loops/index.html#comment-166</guid> <description>I recently had an email request for a similar function set, but without the extra bloat of checking a textarea.  Rather it was just a multiple question, multiple choice radio button form.The method is similar.  In this example, assume there were 5 questions in form id=&quot;frm1&quot;, each with more than 1 radio option as a possible response.&lt;code&gt; function validate() { var theform = document.getElementById(&quot;frm1&quot;);//check radio boxes var setflag; setflag = false; for (i=1; i&lt;6; i++)			// N questions + 1 { for (j=0; j&lt;theform.elements[&quot;q&quot;+i].length; j++) { if (theform.elements[&quot;q&quot;+i][j].checked) { setflag = true; } }if (setflag == false) { alert(&quot;Please Answer Question #&quot; + i); theform.elements[&quot;q&quot;+i][0].focus(); return false; }setflag = false; } } &lt;/code&gt;It&#039;s as easy as that :)Enjoy.</description> <content:encoded><![CDATA[<p>I recently had an email request for a similar function set, but without the extra bloat of checking a textarea.  Rather it was just a multiple question, multiple choice radio button form.</p><p>The method is similar.  In this example, assume there were 5 questions in form id=&#8221;frm1&#8243;, each with more than 1 radio option as a possible response.</p><p><code><br /> function validate() {<br /> &nbsp;&nbsp;var theform = document.getElementById(&quot;frm1&quot;);<br /> <br /> &nbsp;&nbsp;//check radio boxes<br /> &nbsp;&nbsp;var setflag;<br /> &nbsp;&nbsp;setflag = false;<br /> &nbsp;&nbsp;<br /> &nbsp;&nbsp;for (i=1; i&lt;6; i++)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// N questions + 1<br /> &nbsp;&nbsp;{<br /> &nbsp;&nbsp;&nbsp;&nbsp;for (j=0; j&lt;theform.elements[&quot;q&quot;+i].length; j++)<br /> &nbsp;&nbsp;&nbsp;&nbsp;{<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (theform.elements[&quot;q&quot;+i][j].checked)<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setflag = true;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /> &nbsp;&nbsp;&nbsp;&nbsp;}<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;if (setflag == false)<br /> &nbsp;&nbsp;&nbsp;&nbsp;{<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;Please Answer Question #&quot; + i);<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;theform.elements[&quot;q&quot;+i][0].focus();<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<br /> &nbsp;&nbsp;&nbsp;&nbsp;}<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;setflag = false;<br /> &nbsp;&nbsp;}<br /> &nbsp;&nbsp; }<br /> </code></p><p>It&#8217;s as easy as that <img src='http://static.skeymedia.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Enjoy.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using xcache
Page Caching using xcache
Database Caching 1/7 queries in 0.002 seconds using disk
Object Caching 251/254 objects using xcache
Content Delivery Network via static.skeymedia.info

Served from: skeymedia.com @ 2012-05-18 19:50:42 -->
