<?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: Javascript Form Validation?</title>
	<atom:link href="http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/</link>
	<description>public domain playground. friendly entities welcome.</description>
	<pubDate>Sun, 22 Nov 2009 13:19:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tim Boucher</title>
		<link>http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/comment-page-1/#comment-6173</link>
		<dc:creator>Tim Boucher</dc:creator>
		<pubDate>Mon, 19 Sep 2005 04:03:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/#comment-6173</guid>
		<description>PS. If anybody's having trouble posting code, don't worry about it. I've got this all figured out. 

But just FYI, it seems that the Wordpress commenting system filters out the script tag unless you replace the angle brackets with their &#38; lt; style equivalents</description>
		<content:encoded><![CDATA[<p>PS. If anybody&#8217;s having trouble posting code, don&#8217;t worry about it. I&#8217;ve got this all figured out. </p>
<p>But just FYI, it seems that the Wordpress commenting system filters out the script tag unless you replace the angle brackets with their &amp; lt; style equivalents</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Boucher</title>
		<link>http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/comment-page-1/#comment-6172</link>
		<dc:creator>Tim Boucher</dc:creator>
		<pubDate>Mon, 19 Sep 2005 03:49:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/#comment-6172</guid>
		<description>ooh, wait, i only saw davee's. let me try mikes. I love that little array action.</description>
		<content:encoded><![CDATA[<p>ooh, wait, i only saw davee&#8217;s. let me try mikes. I love that little array action.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Boucher</title>
		<link>http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/comment-page-1/#comment-6171</link>
		<dc:creator>Tim Boucher</dc:creator>
		<pubDate>Mon, 19 Sep 2005 03:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/#comment-6171</guid>
		<description>AHHH... that did the trick. Much much simpler than the stuff I was trying to do. I really need to brush up on this stuff.

Thank you very much!</description>
		<content:encoded><![CDATA[<p>AHHH&#8230; that did the trick. Much much simpler than the stuff I was trying to do. I really need to brush up on this stuff.</p>
<p>Thank you very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike oliver</title>
		<link>http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/comment-page-1/#comment-6170</link>
		<dc:creator>mike oliver</dc:creator>
		<pubDate>Mon, 19 Sep 2005 03:45:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/#comment-6170</guid>
		<description>Oops... forgot that tag you mentioned above

&lt;code&gt;





&lt;/code&gt;

And as Davee said... don't forget to amend the form tag to include an onSubmit()</description>
		<content:encoded><![CDATA[<p>Oops&#8230; forgot that tag you mentioned above</p>
<p><code></p>
<p></code></p>
<p>And as Davee said&#8230; don&#8217;t forget to amend the form tag to include an onSubmit()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike oliver</title>
		<link>http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/comment-page-1/#comment-6169</link>
		<dc:creator>mike oliver</dc:creator>
		<pubDate>Mon, 19 Sep 2005 03:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/#comment-6169</guid>
		<description>&lt;code&gt;
function checkForm()
 {
  flag = "off"
  msg = "Please fill in the following missing fields:"
  formObj = document.forms[0]
  numFields = formObj.length - 1

  for(i=0; i&lt; numFields;i++)
    {
    if(formObj.elements[i].value == "")
      {
      if (formObj.elements[i].name != "website")
       {
       msg = msg + "\n - " + formObj.elements[i].name
       flag = "on"
       }
     }
   } 
  
  if (flag == "on")
    { 
    alert(msg)
     return false;
    }
 }
&lt;/code&gt;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code><br />
function checkForm()<br />
 {<br />
  flag = "off"<br />
  msg = "Please fill in the following missing fields:"<br />
  formObj = document.forms[0]<br />
  numFields = formObj.length - 1</p>
<p>  for(i=0; i< numFields;i++)<br />
    {<br />
    if(formObj.elements[i].value == "")<br />
      {<br />
      if (formObj.elements[i].name != "website")<br />
       {<br />
       msg = msg + "\n - " + formObj.elements[i].name<br />
       flag = "on"<br />
       }<br />
     }<br />
   } </p>
<p>  if (flag == "on")<br />
    {<br />
    alert(msg)<br />
     return false;<br />
    }<br />
 }<br />
</code></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: davee</title>
		<link>http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/comment-page-1/#comment-6168</link>
		<dc:creator>davee</dc:creator>
		<pubDate>Mon, 19 Sep 2005 01:50:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.timboucher.com/journal/2005/09/18/javascript-form-validation/#comment-6168</guid>
		<description>Something like this seems to work for me:

&lt;code&gt;

&#60;SCRIPT TYPE="text/javascript"&#62;

function validate_form ( )
{
error = false;
error_string = "Please fill in these field(s):";

if ( document.contact.name.value == "" )
{
error = true;
error_string = error_string + " name";
}
if ( document.contact.email.value == "" )
{
error = true;
error_string = error_string + " email";
}
if ( document.contact.subject.value == "" )
{
error = true;
error_string = error_string + " subject";
}
if ( document.contact.comments.value == "" )
{
error = true;
error_string = error_string + " comments";
}

if (error == true)
{
alert (error_string);
}

return (!error);
}

&#60;/SCRIPT&#62;

&lt;/code&gt;

and don't forget to change the form tag to include an onsubmit:

&lt;code&gt;

&#60;form action="formmail.php" method="post" name="contact" id="contact" onsubmit="return validate_form()"&#62;

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Something like this seems to work for me:</p>
<p><code></p>
<p>&lt;SCRIPT TYPE="text/javascript"&gt;</p>
<p>function validate_form ( )<br />
{<br />
error = false;<br />
error_string = "Please fill in these field(s):";</p>
<p>if ( document.contact.name.value == "" )<br />
{<br />
error = true;<br />
error_string = error_string + " name";<br />
}<br />
if ( document.contact.email.value == "" )<br />
{<br />
error = true;<br />
error_string = error_string + " email";<br />
}<br />
if ( document.contact.subject.value == "" )<br />
{<br />
error = true;<br />
error_string = error_string + " subject";<br />
}<br />
if ( document.contact.comments.value == "" )<br />
{<br />
error = true;<br />
error_string = error_string + " comments";<br />
}</p>
<p>if (error == true)<br />
{<br />
alert (error_string);<br />
}</p>
<p>return (!error);<br />
}</p>
<p>&lt;/SCRIPT&gt;</p>
<p></code></p>
<p>and don&#8217;t forget to change the form tag to include an onsubmit:</p>
<p><code></p>
<p>&lt;form action="formmail.php" method="post" name="contact" id="contact" onsubmit="return validate_form()"&gt;</p>
<p></code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
