Checking the value by name will only work if your servlet knows what to
expect. However, if you are just looking for a way that you can add an
unchecked checkbox to the POST request on submission, do this:

function commit() {
   if (validateForm()) {

document.addForm.action="/servlet/DoUpdate?jrunsessionid=927126305874342151"
      if (!document.addForm.Person_Pets.checked){
         document.addForm.action+="&Person_Pets=NULL";
      }
      if (!document.addForm.Person_Mail_Me.checked){
         document.addForm.action+="&Person_Mail_Me=NULL";
      }
      ...
      document.addForm.submit();
      return true;
   }
   else return false;
}

Then in your HTML, leave the action of your FORM tag blank (since that is
filled in by the Javascript) and for your submit button, have something like
this:

<INPUT type="submit" value="Save Changes" onClick="commit()">

Hope that helps...

Justin Ashworth
Network Applications Developer

Central Design Systems, Inc.
(503) 205-1404
[EMAIL PROTECTED]

> -----Original Message-----
> From: Martin Kuba [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 30, 1999 7:01 AM
> To: [EMAIL PROTECTED]
> Subject: Re: checkboxes and servlets
>
>
> > >Any way by which I could check if a checkbox is selected
> and retrieve the
> > value?
> > >Thanks,
> > >Jeetandra
>
> String opt3 = request.getParameter("opt3");
> if(opt3 != null)
> {//is selected
>  }
> else
> {//is not selected
> }
>
> Martin
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    INET, a.s.                          Mgr. Martin Kuba
> Kralovopolska 139                  e-mail: [EMAIL PROTECTED]
>   601 12 Brno                      WWW: http://www.inet.cz/~makub/
>  Czech Republic                    tel: +420-5-41242414/33
> --------------------------------------------------------------------
> PGP fingerprint = D8 57 47 E5 36 D2 C1 A1  C3 48 B2 59 00 58 42 27
>  http://wwwkeys.cz.pgp.net:11371/pks/lookup?op=index&search=makub
> --------------------------------------------------------------------
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to