You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeremy Haile <me...@yahoo.com> on 2001/12/03 19:34:42 UTC

Indexed checkboxes always checked!!!! Please help!

I have an arraylist of beans which I iterate through. 
Each bean contains 3 boolean values (i.e. checkboxes
on my form).  The form is initially populated through
a database.  

What I would like to do is to update the database
using the form, but when a checkbox is unchecked on my
html form, it is not changed in the ActionForm.  I
have searched the mailing archives, but cannot seem to
find an answer.  How do I know when a user unchecks a
box that is initially checked?  

I cannot initially set the checkboxes to false,
because many of them are initially set to true by way
of the database!

Please help me!!

Jeremy

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Indexed checkboxes always checked!!!! Please help!

Posted by Sai Mattancheril <sa...@fedex.com>.
Jeremy,

HTML checkBoxes dont send a value when unchecked -- which is probably causing the problem.You should override the reset() method of ActionForm in your class.

In this method, set all your boolean variables in the form to false. The reset(ActionMapping am, HttpServletRequest req) method will be automatically called before populating the ActionForm. 

Hope this helps.
Thanks

----- Original Message ----- 
From: "Jeremy Haile" <me...@yahoo.com>
To: <st...@jakarta.apache.org>
Sent: Monday, December 03, 2001 12:34 PM
Subject: Indexed checkboxes always checked!!!! Please help!


> I have an arraylist of beans which I iterate through. 
> Each bean contains 3 boolean values (i.e. checkboxes
> on my form).  The form is initially populated through
> a database.  
> 
> What I would like to do is to update the database
> using the form, but when a checkbox is unchecked on my
> html form, it is not changed in the ActionForm.  I
> have searched the mailing archives, but cannot seem to
> find an answer.  How do I know when a user unchecks a
> box that is initially checked?  
> 
> I cannot initially set the checkboxes to false,
> because many of them are initially set to true by way
> of the database!
> 
> Please help me!!
> 
> Jeremy
> 
> __________________________________________________
> Do You Yahoo!?
> Buy the perfect holiday gifts at Yahoo! Shopping.
> http://shopping.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Indexed checkboxes always checked!!!! Please help!

Posted by Jeremy Haile <me...@yahoo.com>.
I solved my own problem minutes after sending the
mail.  Apparently I didn't understand the reset()
method very well.  Manually looping through the
arraylist and setting the boolean values to false in
the reset() method solved my problem and didn't mess
up the form on the web page (i.e. they were still
checked on the web page due to manually populating the
form).

Jeremy

--- Jeremy Haile <me...@yahoo.com> wrote:
> I have an arraylist of beans which I iterate
> through. 
> Each bean contains 3 boolean values (i.e. checkboxes
> on my form).  The form is initially populated
> through
> a database.  
> 
> What I would like to do is to update the database
> using the form, but when a checkbox is unchecked on
> my
> html form, it is not changed in the ActionForm.  I
> have searched the mailing archives, but cannot seem
> to
> find an answer.  How do I know when a user unchecks
> a
> box that is initially checked?  
> 
> I cannot initially set the checkboxes to false,
> because many of them are initially set to true by
> way
> of the database!
> 
> Please help me!!
> 
> Jeremy
> 
> __________________________________________________
> Do You Yahoo!?
> Buy the perfect holiday gifts at Yahoo! Shopping.
> http://shopping.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>