more onsubmit questions

by Nate Harel <nharel(at)consultant.com>

 Date:  Tue, 03 Jul 2001 17:34:30 -0400
 To:  hwg-techniques(at)hwg.org
  todo: View Thread, Original
Hi all,

I have a form that validates an entry before being submitted as follows:

===================================================
<FORM
	method="post"
	name="buyit"
	onsubmit="return validate(buyit.eop_Size , '<H2>Please select a size for 
ordering....</H2>')" 	action="/cgi-bin/cartit.cgi" target="_blank">
=======================================================

Essentially, it is looking if there is any value in the field or if it is 
blank. If blank it does not submit but returns a warning note. The 
validation code is below:

=========================================
function validate(field, comment)
{
var formset = field;

if ( formset.value != "" )
	{
	window.close();
	return true;
	}
else
	{
	document.write(comment);
	window.setTimeout('history.back()', '1500');
	return false;
	}
============================================

So far, so good. All works well.
HOWEVER, I need to verify more than 1 field at times, perhaps 3-4 fields. 
Is there a way to do this with the JS code, or simply add another test to 
the FORM  or what ???


Thanks for your help.

Nate



		---------------------------------------------------
			 Nate Harel
		        NetTech Services
		        66 Carol Road
		  Needham, MA  02492-1108
		    Tel: 1-781-559-8176
		 Toll Free: 1-877-567-8936
		   FAX: 1-877-567-8936
		 Email: nharel(at)consultant.com
			www.nettsv.com
		----------------------------------------------------

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA