<?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>Tue, 01 Jun 2010 15:36:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</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><pre><code>
function validate() {
&nbsp;&nbsp;var theform = document.getElementById(&quot;frm1&quot;);

&nbsp;&nbsp;//check radio boxes
&nbsp;&nbsp;var setflag;
&nbsp;&nbsp;setflag = false;
&nbsp;&nbsp;
&nbsp;&nbsp;for (i=1; i&lt;6; i++)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// N questions + 1
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;for (j=0; j&lt;theform.elements[&quot;q&quot;+i].length; j++)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (theform.elements[&quot;q&quot;+i][j].checked)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setflag = true;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;if (setflag == false)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;Please Answer Question #&quot; + i);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;theform.elements[&quot;q&quot;+i][0].focus();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;setflag = false;
&nbsp;&nbsp;}
&nbsp;&nbsp; }
</code></pre></p>
<p>It&#8217;s as easy as that <img src='http://skeymedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Enjoy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
