users
[Top] [All Lists]

Re: [cinjug-users] jsp form question

To: users@xxxxxxxxxx
Subject: Re: [cinjug-users] jsp form question
From: "Jason Kretzer/STAR BASE Consulting Inc." <JKretzer@xxxxxxxxxxxxxxx>
Date: Fri, 2 Apr 2004 10:06:55 -0500
Delivered-to: mailing list users@cinjug.org
In-reply-to: <OF9A0EE206.E51E68BD-ON85256E6A.004CB838-85256E6A.004D118C@starbaseinc.com>
Mailing-list: contact users-help@cinjug.org; run by ezmlm

OK, I have it now.  I used :

//for the submit button
>

//then in validateFields I got the form and checked each field for a value and then submitted when all had a value, like so:
var thisForm = document.forms[0];
               
                if(thisForm.comp.value == '')
                {
                        alert('Company name is required.');
                        thisForm.comp.focus();
                        return;
                }
                else if(thisForm.desc.value == '')
                {
                        alert('Short description is required.');
                        thisForm.desc.focus();
                        return;
                }
                else if(thisForm.addr.value == '')
                {
                        alert('An address is required.');
                        thisForm.addr.focus();
                        return;
                }
                ///....etc.
                else
                {
                        thisForm.method.value = 'POST';
                        thisForm.action = "">'FormProcessor?action="">;
                        thisForm.submit();
                }

Thanks for the help everyone.  My problem is that I did not know you could perform the commands in that last else in _javascript_.

-Jason



"Jason Kretzer/STAR BASE Consulting Inc." <JKretzer@xxxxxxxxxxxxxxx>

04/02/2004 09:00 AM

To
users@xxxxxxxxxx
cc
Subject
[cinjug-users] jsp form question






Good morning all,


I have a question about form submission.  I have a jsp that has a form of about 12 input fields.  All of the fields are required to have something in them.  Is there a way to have a _javascript_ to do this and then still POST the form to a servlet?


Thanks,


-Jason

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