RE: checkboxproblem
See this in the Struts documentation: http://jakarta.apache.org/struts/struts-html.html#checkbox Somewhere else the documentation explains why. Basically HTTP does not send checkbox values of false back to the server, so if your ActionForm reset method sets the boolean value(s) to false, any checked values will be sent and the subsequent population of the form from the request with these checked values will result in the form holding the desired data. -Original Message- From: Kristine Weissbarth [mailto:[EMAIL PROTECTED] Sent: 12 June 2003 09:30 To: Struts Users Mailing List Subject: checkboxproblem hi, In my web application I'm using one form where several checkboxes with different names and other textfields are listed. The checkboxes value is set to true. My problem is that per default the checkbox should be checked but the user has the possibility to uncheck it. In the last case the checkbox should be set to false/null but it isn't. It is still true. Why? And what can I do to solve this problem? Thanks for every hint. Kristine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkboxproblem
Hi, In the reset method you need to set as false, other wise it won't uncheck the selection. Thanks Regards, Ashok.D - Original Message - From: Kristine Weissbarth [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 1:59 PM Subject: checkboxproblem hi, In my web application I'm using one form where several checkboxes with different names and other textfields are listed. The checkboxes value is set to true. My problem is that per default the checkbox should be checked but the user has the possibility to uncheck it. In the last case the checkbox should be set to false/null but it isn't. It is still true. Why? And what can I do to solve this problem? Thanks for every hint. Kristine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkboxproblem
Set the checkbox values to true in the Action that displays your form not in the reset method of your ActionForm. You'll find more detail on this if you search the list archives. Steve -Original Message- From: Kristine Weissbarth [mailto:[EMAIL PROTECTED] Sent: June 12, 2003 1:30 AM To: Struts Users Mailing List Subject: checkboxproblem hi, In my web application I'm using one form where several checkboxes with different names and other textfields are listed. The checkboxes value is set to true. My problem is that per default the checkbox should be checked but the user has the possibility to uncheck it. In the last case the checkbox should be set to false/null but it isn't. It is still true. Why? And what can I do to solve this problem? Thanks for every hint. Kristine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkboxproblem
Hallo Kristine, you may also see my mail with subject: Question about the reset() method from today. Regards, Dirk *** KW hi, KW In my web application I'm using one form where several checkboxes with KW different names and other textfields are listed. The checkboxes value is KW set to true. My problem is that per default the checkbox should be KW checked but the user has the possibility to uncheck it. In the last case KW the checkbox should be set to false/null but it isn't. It is still true. KW Why? And what can I do to solve this problem? KW Thanks for every hint. KW Kristine. KW - KW To unsubscribe, e-mail: [EMAIL PROTECTED] KW For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkboxproblem
I think I know what you mean, but the problem is that the checkboxes should be checked if a user comes on the site for the first time. If I set all the checkboxes in the reset method to false wouldn't the checkboxes be always set to false unless the user checks it? Am Don, 2003-06-12 um 11.10 schrieb ashokd: Hi, In the reset method you need to set as false, other wise it won't uncheck the selection. Thanks Regards, Ashok.D - Original Message - From: Kristine Weissbarth [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 1:59 PM Subject: checkboxproblem hi, In my web application I'm using one form where several checkboxes with different names and other textfields are listed. The checkboxes value is set to true. My problem is that per default the checkbox should be checked but the user has the possibility to uncheck it. In the last case the checkbox should be set to false/null but it isn't. It is still true. Why? And what can I do to solve this problem? Thanks for every hint. Kristine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Antwort: Re: checkboxproblem
Hi Kristine, first you have to initialize the checkbox variable with on. If a user sets a checkboy to false, there is no string posted in the http-submit. You can check up submit for your parameter and set the variable to false if the parameter is missing. Example: HttpServletRequest request) { String checkbox = off; ActionErrors errors = new ActionErrors(); Enumeration enem = request.getParameterNames(); bool test = false; while(enem.hasMoreElements()) { String param = (String)enem.nextElement(); if(param.equalsIgnoreCase(submit)) { test = true; } } if (bool == false) { checkbox = off } } |-+--- | | | | | | | | | | |Kristine Weissbarth| | |[EMAIL PROTECTED]| | |12.06.2003 13:05 | | |Bitte antworten an Struts Users | | |Mailing List | | | | |-+--- | | | | An: Struts Users Mailing List [EMAIL PROTECTED] | | Kopie: | | Thema: Re: checkboxproblem | | I think I know what you mean, but the problem is that the checkboxes should be checked if a user comes on the site for the first time. If I set all the checkboxes in the reset method to false wouldn't the checkboxes be always set to false unless the user checks it? Am Don, 2003-06-12 um 11.10 schrieb ashokd: Hi, In the reset method you need to set as false, other wise it won't uncheck the selection. Thanks Regards, Ashok.D - Original Message - From: Kristine Weissbarth [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 1:59 PM Subject: checkboxproblem hi, In my web application I'm using one form where several checkboxes with different names and other textfields are listed. The checkboxes value is set to true. My problem is that per default the checkbox should be checked but the user has the possibility to uncheck it. In the last case the checkbox should be set to false/null but it isn't. It is still true. Why? And what can I do to solve this problem? Thanks for every hint. Kristine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]