users
[Top] [All Lists]

Re: [cinjug-users] jsp form question

To: Eric Galluzzo <egalluzzo@xxxxxxxxxxxxxxx>
Subject: Re: [cinjug-users] jsp form question
From: Eric Galluzzo <egalluzzo@xxxxxxxxxxxxxxx>
Date: Fri, 02 Apr 2004 11:08:23 -0500
Cc: "Jason Kretzer/STAR BASE Consulting Inc." <JKretzer@xxxxxxxxxxxxxxx>, users@xxxxxxxxxx
Delivered-to: mailing list users@cinjug.org
In-reply-to: <406D8F5C.9020401@einnovation.com>
Mailing-list: contact users-help@cinjug.org; run by ezmlm
References: <OF2C8A15F1.119E1842-ON85256E6A.005303A5-85256E6A.00531DBB@starbaseinc.com> <406D8F5C.9020401@einnovation.com>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007
Eric Galluzzo wrote:

function validate()
{
   var thisForm = document.forms[0];
   var fields = new Array(
       { name: "comp", description: "Company name" },
       { name: "desc", description: "Short description" },
       { name: "addr", description: "An address" },
       // ...etc.
   );

   for ( var i = 0; i < elements.length; i++ )
   {
       var element = thisForm.elements[fields[i].name];
       if ( element.value == '' )
       {
           alert( fields[i].description + ' is required.' );
           field.focus();

Oops, that should be:

element.focus();

           return;
       }
   }

   thisForm.method.value = 'POST';
   thisForm.action = 'FormProcessor?action=a';
   thisForm.submit();
}




<Prev in Thread] Current Thread [Next in Thread>