struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manuel Lenz" <...@viessmann.com>
Subject Antwort: Re: checkboxproblem
Date Thu, 12 Jun 2003 11:11:29 GMT

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                |
|         |<kristine.weissbarth@sourcepark.de>|
|         |12.06.2003 13:05                   |
|         |Bitte antworten an "Struts Users   |
|         |Mailing List"                      |
|         |                                   |
|---------+----------------------------------->
  >----------------------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                                     |
  |     An:      Struts Users Mailing List <struts-user@jakarta.apache.org>        
                                           |
  |     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" <kristine.weissbarth@sourcepark.de>
> To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> 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: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org







---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message